C code programming to reverse a string?

Answer:
#include <stdio.h>

main ()
{
int i=0,k=0,j;
char a[30],b[30];
printf("\nEnter the string:\n");
gets(a);
while(a[i++]!='\0')
k++;
for (i = 0,j=k-1; i <k,j>=0 ; i++,j--)
b[i] = a[j];

printf("%s",b);
return(0);



}
First answer by Archangel dmitry. Last edit by Rani140. Contributor trust: 0 [recommend contributor recommended]. Question popularity: 12 [recommend question].