Question: >> C code please according to instructions. ONLY C code. < < Q1. Write a C function with the following prototype: void spacesToXs(char *s) This
>> C code please according to instructions. ONLY C code. << Q1. Write a C function with the following prototype: void spacesToXs(char *s) This function replaces ALL space characters in the string 's' with the character 'X' (capital X). See the examples below: original string: altered string: "j a w s" "jXaXwXs" " " "XXXX" "are you ok X?" "areXyouXokXX?" Q2. Write a C function with the following prototype: unsigned int howManyVowels(const char *s) That determines how many vowels (alphabetic letters 'a', 'e', 'i', 'o', or 'u') UPPER or lowercase are contained in the string 's'. Once complete, the function returns the total number of vowels found or the value 0 if no vowels are found. For example, string: return value: "123-xyz" 0 "This is PRG355@SENECA" 5 Q3. Write a C function with the following prototype: void mirrorImage(char *s) that accepts a string 's' containing at least 4 characters and reverses the order of the characters in each half of the string. For example, original string: altered string: "123456789" "432159876" "hello world" "olleh dlrow" "even" "vene" MAIN PROGRAM: // Your solution may ONLY use functions from the following // included C library header files. #include#include #include // function prototypes: void spacesToXs(char *s); unsigned int howManyVowels(const char *s); void mirrorImage(char *s); int main( ) { int i; unsigned int rv; char words1[3][31] = { "j a w s", " ", "are you OK X?" }; char words2[2][81] = { "123-xyz", "This is PRG355@SENECA" }; char images[3][31] = { "123456789", "hello world", "even" }; for(i=0; i<3; i++) { spacesToXs(words1[i]); printf("'%s' ", words1[i]); } for(i=0; i<2; i++) { rv = howManyVowels(words2[i]); printf("%u ", rv); } for(i=0; i<3; i++) { mirrorImage(images[i]); printf("%s ", images[i]); } return 0; } /* CORRECT OUTPUT: 'jXaXwXs' 'XXXX' 'areXyouXOKXX?' 0 5 432159876 olleh dlrow vene */
// You may add your own helper functions or symbolic constants here. // Functions that you add to this code MUST also be prototyped here. void spacesToXs(char *s) { // your code here ... } unsigned int howManyVowels(const char *s) { // your code here ... } void mirrorImage(char *s) { // your code here ... } Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
