home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / prof_c / util / last_ch.c < prev    next >
Encoding:
Text File  |  1988-08-11  |  279 b   |  21 lines

  1. /*
  2.  *    last_ch -- return a copy of the last character
  3.  *    before the NUL byte in a string
  4.  */
  5.  
  6. char
  7. last_ch(s)
  8. char *s;
  9. {
  10.     register char *cp;
  11.  
  12.     /* find end of s */
  13.     cp = s;
  14.     while (*cp != '\0')
  15.         ++cp;
  16.  
  17.     /* return previous character */
  18.     --cp;
  19.     return (*cp);
  20. }
  21.