Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Transactions On Large Scale Data And Knowledge Centered Systems Xxiv Special Issue On Database And Expert Systems Applications Lncs 9510

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Hendrik Decker ,Lenka Lhotska ,Sebastian Link

1st Edition

366249213X, 978-3662492130

More Books

Students also viewed these Databases questions