Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

LOQ 5-16: What are the social tasks and challenges of adolescence?

Answered: 1 week ago