Question: #include #include unsigned char* strstr(const char *str, const char *target) { unsigned char *s; if (!*target) return (unsigned char *)str; s = (unsigned char*)str; while
#include
unsigned char* strstr(const char *str, const char *target) {
unsigned char *s; if (!*target) return (unsigned char *)str;
s = (unsigned char*)str;
while (*s) { char *start = s, *t = (char*)target;
while (*s && *t && *s == *t) { s++; t++; } if (!*t) return (unsigned char *) start;
s = start + 1; }
return (unsigned char *) 0; }
int main(){
char str1[] = "123456565656987";
char str2[] = "698";
unsigned char *p;
volatile int position = -1;
p = strstr (str1, str2);
if ( p != 0) position = (void *)p - (void *)str1 + 1;
printf("%d ", position); printf("%s ", p); getch(); }''

this is the output of this code. can anyone explain me the output.
Select C:\UsersitasnilDesktop\yhm.exe 12 6987
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
