I relatively new to low level programming such as c. I am reviewing the strstr() function here. When reviewing the function definition char *strstr(const char *str1, const char *str2);
I understand that function will return a pointer or a NULL depending if str2 was found in str1.
What I can't understand though, is if the funciton requires the two inputs to be pointers, when does the example not use pointers?
#include <string.h>
int main ()
{
char string[55] ="This is a test string for testing";
char *p;
p = strstr (string,"test");
if(p)
{
printf("string found\n" );
printf ("First occurrence of string \"test\" in \"%s\" is"\
" \"%s\"",string, p);
}
else printf("string not found\n" );
return 0;
}