#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> int main() { char s[1000]; char a[100][21]; int i,n; while (gets(s)!=NULL) { char *p; n=0; p = strtok(s, " "); while (p) { //printf("%s ", p); // save string in array strcpy(a[n++],p); p = strtok(NULL, " "); } for (i=0;i<n;i++) { printf("%s ",strrev(a[i])); } printf("\n"); } return 0; } /* Main.c: In function 'main': Main.c:12:2: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations] while (gets(s)!=NULL) ^ Main.c:27:4: warning: implicit declaration of function 'strrev' [-Wimplicit-function-declaration] printf("%s ",strrev(a[i])); ^ Main.c:27:4: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'int' [-Wformat=] /tmp/cc0S5YW3.o: In function `main': Main.c:(.text+0xeb): warning: the `gets' function is dangerous and should not be used. Main.c:(.text+0xb5): undefined reference to `strrev' collect2: error: ld returned 1 exit status */ |
Double click to view unformatted code.