home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / ctutor2.zip / BACKWARD.C < prev    next >
Text File  |  1989-11-10  |  763b  |  38 lines

  1.                                          /* Chapter 5 - Program 6 */
  2. #include "stdio.h"      /* Prototypes for standard Input/Output   */
  3. #include "string.h"     /* Prototypes for string operations       */
  4.  
  5. void forward_and_backwards(char line_of_char[],int index);
  6.  
  7. void main()
  8. {
  9. char line_of_char[80];
  10. int index = 0;
  11.  
  12.    strcpy(line_of_char,"This is a string.\n");
  13.  
  14.    forward_and_backwards(line_of_char,index);
  15.  
  16. }
  17.  
  18. void forward_and_backwards(char line_of_char[],int index)
  19. {
  20.    if (line_of_char[index]) {
  21.       printf("%c",line_of_char[index]);
  22.       index++;
  23.       forward_and_backwards(line_of_char,index);
  24.    }
  25.    printf("%c",line_of_char[index]);
  26. }
  27.  
  28.  
  29.  
  30.  
  31. /* Result of execution
  32.  
  33. This is a string.
  34.  
  35. .gnirts a si sih
  36.  
  37. */
  38.