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 6987Step 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