Question: The program needs to be written in C. Write a function void camelCase(char* word) where word consists of more than two words separated by underscore

The program needs to be written in C.

Write a function void camelCase(char* word) where word consists of more than two words separated by underscore such as random_word or "hello_world_my_name_is_sam". camelCase() should remove underscores from the sentence and rewrite in lower camel case (https:// en.wikipedia.org/wiki/Camel_case). Watch out for the end of the string, which is denoted by \0. You have to ensure that legal strings are given to the camelCase() function.

NOTE: You can use the toUpperCase(...) a function provided in the skeletal code to change the case of a character from lowercase to upper case . Notice that toUpperCase() assumes that the character is currently in lower case. Therefore, you would have to check the case of a character before calling toUpperCase().

Here's the skeletal code:

#include #include

/*converts ch to upper case, assuming it is in lower case currently*/ char toUpperCase(char ch){ return ch-'a'+'A'; }

void camelCase(char* word){ /*Convert to camelCase*/ }

int main(){ /*Read the string from the keyboard */ /*Call camelCase*/ /*Print the new the string */ return 0; }

Example: if you typed in "hello_world_my_name_is_sam" the output should be "helloWorldMyNameIsSam"

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!