Program to reverse a string
/*This is a program to reverse a given string that is taken from keyboard as input*/
#include<stdio.h>
#define length 20
main(){
int a[length];
int c=getchar();
int i=0,k=0;
while((c!='\n'))
{
a[i]=c;
i++;
c=getchar();
}
for(k=i-1;k>=0;k--)
printf("%c",a[k]);
}
#include<stdio.h>
#define length 20
main(){
int a[length];
int c=getchar();
int i=0,k=0;
while((c!='\n'))
{
a[i]=c;
i++;
c=getchar();
}
for(k=i-1;k>=0;k--)
printf("%c",a[k]);
}