Answered step by step
Verified Expert Solution
Question
1 Approved Answer
const Implement a function with the following interface: char *my_toupper(char *dest, char *src). Function argument src points to the string that you should modify as
const Implement a function with the following interface: char *my_toupper(char *dest, char *src). Function argument src points to the string that you should modify as described below. The modified string will be written at address dest. In addition the function should return pointer to the modified string (i.e., to the same address dest originally points to). The string should be modified in the following ways: all letter characters should be changed to upper case. You can use function toupper, that converts one character to upper case for this. toupper is defined in header ctype.h, so you should add #include at the beginning of your program if you decide to do this. If the original string has a question mark (?'), it should be changed to exclamation mark (!). If the original string has period (..), it should be replaced with three exclamation marks. You will not modify the original string, but write the result in location pointed by the dest variable. For example the following main function: #include // for printi #include // for memset #include // for toupper int main(void) { char dest [200); /* The following helps detecting string errors, e.g. missing final nil */ memset (dest, '#', 199); dest[199] = 0; printf("%s", my_toupper (dest, "Would you like to have a sausage? It will be two euros. Here you are. ")) printf("3", my_toupper (dest, "Madam, where are you going? The health care center is over there. ")); return 0; } Would output: WOULD YOU LIKE TO HAVE A SAUSAGE! IT WILL BE TWO EUROS!!! HERE YOU ARE!!! MADAM, WHERE ARE YOU GOING! THE HEALTH CARE CENTER IS OVER THERE
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