Question
Q3) Write a C program that takes two-character arrays of size 15 from the user. The program will take the name and surname of the
Q3) Write a C program that takes two-character arrays of size 15 from the user. The program will take the name and surname of the user using scanf function. Then write a function called capitalize which receives the strings as pointer arguments. The function will only capitalize the first letter of the name and surname strings. The rest of the characters should be lowercase and if there is an upper-case letter except the first one, it should be converted to lower-case. Also, the function will print the name and surname with one space between each other. Hint 1: Pass the arguments using call-by-reference method and write the function using pointer definition. Hint 2: Use the function prototype void capitalize(char *s1, char *s2); Hint 3: Use isupper and islower functions to detect the upper case and lowercase letters. Use toupper and tolower functions to convert lower case letters to uppercase and uppercase letters to lowercase. These functions are defined in ctype.h library. Hint 4: If the name of the user is entered as gEoRGe and the surname is entered as BeST, then after applying the capitalize function, the program will print George Best.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started