Question
In C language: Implement function void qstr_print(const char *s) that outputs string s until the first instance of the string terminating ?. However, the hash
In C language:
Implement function void qstr_print(const char *s) that outputs string s until the first instance of the string terminating ?. However, the hash character should not be printed.
Implement function unsigned int qstr_length(const char *s) that returns the number of characters in array s before the terminating ?. The hash character should not be included in count.
Implement function int qstr_cat(char *dst, char *src), that appends a copy of the string src to the dst string. The function should return the number of the characters in the final dst string. The function should copy characters only until the first ? character and after copying the destination string must also terminate with ?. (Hint: you can test that the destination string looks correct by using the qstr_print function).
Implement function const char *qstr_strstr(const char *str1, const char *str2) that searches for the substring str2 from the string str1. The function should return a pointer to the first occurance of str2 in str1. If the substring isnt found, the function should return NULL (note that NULL is defined in stddef.h header). Remember that the function should only search until the first ? character.
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