Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function which takes a C string as an input and converts it to all upper

ID: 3660962 • Letter: W

Question

Write a function which takes aC stringas an input and converts it to all uppercase characters. For each lowercase character in theC string, simply subtract 32 from it to form the uppercase character. Any non-alphabetic character in theC stringshould not be changed. You are not allowed to use any other functions to do this. Do not write a main function. Your function does not do anycin
orcout. Hint: lowercase characters are between 'a' and 'z' where the value of 'z' equals the value of 'a' + 25. Remember,C stringsare terminated with the '' character. Make sure to properly format all your code.

Explanation / Answer

void convertToUpper( char base[]) { char temp; for (int i = 0; i 'Z' && base[i] < 'a') || base[i] > 'z') continue; else if( base[i] >= 'a') base[i] = base[i] - 32; } }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote