strchr Function

  • It returns a pointer to the first occurrence of ch in *str or a null pointer if ch not found .


  • Syntax:

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

    Example:

    
    
    
    #include <stdio.h>
    
    #include <string.h>
    
      int main()
    
      {
    
        char *p;
    
    
    
        p = strchr("this is a test", ' ');
    
        printf(p);
    
    
    
        return 0;
    
      }
    Back