How to write a C program to print reversely a given string ?
Solution:
/* C program to print reversely a given string */
#include<stdio.h>
#include<string.h>
int main(void)
{
int i,j=0,x;
char a[999999];
char b[999999];
printf("Please enter string:\n");
gets(a);
x=strlen(a)-1;
for(i=x;i>=0;i--)
{
b[j]=a[i];
j++;
}
b[j]='\0';
puts(b);
return 0;
}