home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / C / DLIBSSRC.ZIP / STRPOS.C < prev    next >
Encoding:
Text File  |  1987-06-14  |  319 b   |  18 lines

  1. int strpos(string, symbol)
  2. register char *string;
  3. register char symbol;
  4. /*
  5.  *    Return the index of the first occurance of <symbol> in <string>.
  6.  *    -1 is returned if <symbol> is not found.
  7.  */
  8. {
  9.     register int i = 0;
  10.  
  11.     do {
  12.         if(*string == symbol)
  13.             return(i);
  14.         ++i;
  15.     } while(*string++);
  16.     return(-1);
  17. }
  18.