fork(1) download
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main(void){
  4. int a[1024];
  5. int b[1024];
  6. int c[1024];
  7. // int ca=0;
  8. // int cb=0;
  9. // int cc=0;
  10. gets(a);
  11. gets(b);
  12. gets(c);
  13. printf("%s\n",a);
  14. printf("%s\n",b);
  15. printf("%s\n",c);
  16. int la = strlen(a);
  17. int lb = strlen(b);
  18. int lc = strlen(c);
  19. printf("%d\n",la);
  20. printf("%d\n",lb);
  21. printf("%d\n",lc);
  22. for(int i = 0;i<la;i++){
  23. printf("%d",a[i]);
  24. }
  25.  
  26. return(0);
  27. }
Compilation error #stdin compilation error #stdout 0s 2296KB
stdin
1 2 3
4 5
6
compilation info
prog.c: In function ‘main’:
prog.c:10:2: warning: ‘gets’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
  gets(a);
  ^
prog.c:10:2: warning: passing argument 1 of ‘gets’ from incompatible pointer type [enabled by default]
In file included from prog.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__;
              ^
prog.c:11:2: warning: ‘gets’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
  gets(b);
  ^
prog.c:11:2: warning: passing argument 1 of ‘gets’ from incompatible pointer type [enabled by default]
In file included from prog.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__;
              ^
prog.c:12:2: warning: ‘gets’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
  gets(c);
  ^
prog.c:12:2: warning: passing argument 1 of ‘gets’ from incompatible pointer type [enabled by default]
In file included from prog.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__;
              ^
prog.c:13:2: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int *’ [-Wformat=]
  printf("%s\n",a);
  ^
prog.c:14:2: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int *’ [-Wformat=]
  printf("%s\n",b);
  ^
prog.c:15:2: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int *’ [-Wformat=]
  printf("%s\n",c);
  ^
prog.c:16:2: warning: passing argument 1 of ‘strlen’ from incompatible pointer type [enabled by default]
  int la = strlen(a);
  ^
In file included from prog.c:2:0:
/usr/include/string.h:395:15: note: expected ‘const char *’ but argument is of type ‘int *’
 extern size_t strlen (const char *__s)
               ^
prog.c:17:2: warning: passing argument 1 of ‘strlen’ from incompatible pointer type [enabled by default]
  int lb = strlen(b);
  ^
In file included from prog.c:2:0:
/usr/include/string.h:395:15: note: expected ‘const char *’ but argument is of type ‘int *’
 extern size_t strlen (const char *__s)
               ^
prog.c:18:2: warning: passing argument 1 of ‘strlen’ from incompatible pointer type [enabled by default]
  int lc = strlen(c);
  ^
In file included from prog.c:2:0:
/usr/include/string.h:395:15: note: expected ‘const char *’ but argument is of type ‘int *’
 extern size_t strlen (const char *__s)
               ^
prog.c:22:2: error: ‘for’ loop initial declarations are only allowed in C99 mode
  for(int i = 0;i<la;i++){
  ^
prog.c:22:2: note: use option -std=c99 or -std=gnu99 to compile your code
stdout
Standard output is empty