home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource4 / 221_01 / reverse.c < prev    next >
Encoding:
Text File  |  1979-12-31  |  256 b   |  12 lines

  1. /*
  2. **  reverse str in place
  3. */
  4. reverse(str) char *str; {
  5. int c, i, j;
  6.   for(i=0, j=strlen(str)-1; i<j; ++i, --j) {
  7.     c=str[i];
  8.     str[i]=str[j];
  9.     str[j]=c;
  10.     }
  11.   }
  12.