#include <stdio.h> #include <string.h> int main() { int a[100],len; gets(a); len=strlen(a); for(i=0;i<len-2;--i) printf("%d ",a[i]); printf("%d",a[len-1]); } /* Main.c: In function 'main': Main.c:6:4: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations] gets(a); ^ Main.c:6:9: warning: passing argument 1 of 'gets' from incompatible pointer type gets(a); ^ In file included from Main.c:1:0: /usr/include/stdio.h:638:14: note: expected 'char *' but argument is of type 'int *' extern char *gets (char *__s) __wur __attribute_deprecated__; ^ Main.c:7:15: warning: passing argument 1 of 'strlen' from incompatible pointer type len=strlen(a); ^ In file included from Main.c:2:0: /usr/include/string.h:399:15: note: expected 'const char *' but argument is of type 'int *' extern size_t strlen (const char *__s) ^ Main.c:8:8: error: 'i' undeclared (first use in this function) for(i=0;i<len-2;--i) ^ Main.c:8:8: note: each undeclared identifier is reported only once for each function it appears in */ |
Double click to view unformatted code.