home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / unixtools / util / c / strcchr < prev    next >
Text File  |  1992-07-21  |  323b  |  19 lines

  1. /*      > C.Strcchr - count the no of occurrences of a character in a string */
  2.  
  3. #include <ctype.h>
  4. #include "utils.h"
  5.  
  6. int strcchr (const char *s, char c)
  7. {
  8.         int i = 0;
  9.  
  10.         while ( *s )
  11.         {
  12.                 if ( *s == c )
  13.                         ++i;
  14.                 ++s;
  15.         }
  16.  
  17.         return (i);
  18. }
  19.