Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
The strstr searchs the first arg for the first occurrence of the 2nd argument. If it finds it it returns a character pointer to the first occurrence. It it doesn't find it, it returns a null pointer.
Since strstr("abcdefgh", "efg") is true, placeing ! in front makes it false.
All the not, the ! character, does is allow you to substitute this code:
char *found;
/*remember that NULL is false */
found=strstr("abcdefgh","hhh");
if(found == NULL)
printf("efg is not there\n");with this:
/* its true that hhh is not there */
if(!strstr("abcdefgh","hhh"))
printf("efg is not there\n");

![]() |
Kernel Install Question
|
Linux user and password r...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |