#include <stdio.h> #include <string.h> int main() { char a[100]; char b[100]; int i; int n; int j = 0; gets(a); n = strlen(a); for(i = n-1;i>=0;i--) { b[j] = a[i]; j++; } b[j] = '\0' puts(b); return 0; } /* Main.c: In function 'main': Main.c:10:2: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations] gets(a); ^ Main.c:18:2: error: expected ';' before 'puts' puts(b); ^ Main.c:6:7: warning: variable 'b' set but not used [-Wunused-but-set-variable] char b[100]; ^ */ |
Double click to view unformatted code.