Question
In C, implement function const char *qstr_strstr(const char *str1, const char *str2) that searches for the substring str2 from the string str1 . The function
In C, 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. (Do not use string.g library)
For example, if the function gets the following strings as parameters:
char *str1 = "Auto ajoi katua pitkin?"; char *str2 = "katu?";
it should return a pointer that points to the first character of the word katua where the first occurance of the substring katu begins.
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