Question
question 1) write a complete program following these instructions: main.c: contains main function that calls each function in myfunctions.c. myfunctions.h: header file to hold the
question 1) write a complete program following these instructions: main.c: contains main function that calls each function in myfunctions.c. myfunctions.h: header file to hold the prototypes of myfunctions.c. myfunctions.c: void tokenizer(char str[]) that tokenizes str using function strtok and outputs the tokens in(( reverse order.)) its should be in reverse int totalOcc(char str[],char ch) that returns the total occurance of ch in str using strchr function. char *sortedStrings(char *str[]) that returns a pointer to a sorted array of strings.
You may use one of the sorting methods discussed in Ch.6 plus string comparison functions discussed in class. Submit the code with the Compile , run commands and some examples included as a comment.
__________________________________ question2) Trace and write the output of the following code. If the statement contains an error, describe the error and how to correct it. 1. char s1[50]=jack, s2[50]=jill,s3[50],*sptr; 2. printf(%c%s, toupper(s1[0]),&s1[1]) 3. printf(%s,strcpy(s3,s2)); 4. printf(%s),strcat(strcpy(s3,s1), and ),s2); 5. printf(%u, strlen(s1) + strlen(s2)); 6. printf(%u, strlen(s3)); 7. char s[10]; 8. strncpy(s, hello, 5); 9. printf(%s , s); 10.printf(%s, a); 11.char s[12]; 12.strcpy(s,Welcome string2); 13.if ( strcmp (string1, string2)) 14. printf(The strings are equal );
(in C programing language) thanks
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