Question: Problem 1.) For Fig. 10 on page 317 in the textbook, the function convertToUppercase(char *sPt) was using the library function in ctyreh. As discussed in

 Problem 1.) For Fig. 10 on page 317 in the textbook,

Problem 1.) For Fig. 10 on page 317 in the textbook, the function convertToUppercase(char *sPt) was using the library function in ctyreh. As discussed in class, please rewrite this function by yourself. Hint: please use ASCII code and by now rather than using "swith statement in C. you may use character array as lookup table. ! // Fig. 7.10: fig07_10.C 2 // Converting a string to uppercase using a 3 // non-constant pointer to non-constant data. 4 #include 5 #include 6 7 void convertToUppercase(char *sptr); // prototype 8 9 int main(void) 10 { II char string[] - "characters and $32.98"; // initialize char array 12 13 printf("The string before conversion is: %s", string): 14 convert Touppercase(string); 15 printf(" The string after conversion is: %s ", string): 16 } 17 18 // convert string to uppercase letters 19 void convertTouppercase(char *sptr) 20 { 21 while (sptr !- '\0') { // current character is not '0' 22 *SPtr - toupper(sptr); // convert to uppercase 23 ++Ptr; // make sPtr point to the next character 24 } 25} The string before conversion is: Characters and $32.98 The string after conversion is: CHARACTERS AND $32.98 Fig. 7.10 Converting a string to uppercase using a non-constant pointer to non-constant data

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!