previous | start | next

C Strings: Searching

There are functions to search for the first occurrence of a given char in a string or to search for the first occurence of a string as a substring in another string.

        char * strchr(const char *str1, int ch);

        char * strstr(const char *str1, const char *str2);
     

Both return NULL if the second parameter is not found in str1.



previous | start | next