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 #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(); }''

#include #include unsigned char* strstr(const char *str, const char *target) { unsigned

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!