Print the string in the reverse order : Console Output String « Console « C / ANSI-C






Print the string in the reverse order


#include <string.h>
#include <stdio.h>

void pr_reverse(char *s);

int main(void)
{
  pr_reverse("I like C");

  return 0;
}

void pr_reverse(char *s)
{
  register int i;

  for(i = strlen(s) - 1; i >= 0; i--) 
      putchar( s [ i ] );
}


  

           
       








Related examples in the same category

1.Displaying a string
2.Displaying a Quotation: the main function
3.prints Hello on standard output
4.Read and output string
5.Output string to console
6.A simple example for printf
7. Output a string to stdout: how to use puts