fork download
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main(){
  4. String a,b;
  5. scanf("%[^\n]s",a);
  6. scanf("%[^\n]s",b);
  7. int alen,blen;
  8. alen=strlen(a);
  9. blen=strlen(b);
  10.  
  11. printf("%d\n",alen);
  12. printf("%d\n",blen);
  13. return 0;
  14. }
Compilation error #stdin compilation error #stdout 0s 4556KB
stdin
Hello world
 Hello world
compilation info
prog.c: In function ‘main’:
prog.c:4:2: error: unknown type name ‘String’; did you mean ‘stdin’?
  String a,b;
  ^~~~~~
  stdin
prog.c:5:12: warning: format ‘%[^
   ’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]
  scanf("%[^\n]s",a);
         ~~~^~    ~
prog.c:6:12: warning: format ‘%[^
   ’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]
  scanf("%[^\n]s",b);
         ~~~^~    ~
prog.c:8:14: warning: passing argument 1 of ‘strlen’ makes pointer from integer without a cast [-Wint-conversion]
  alen=strlen(a);
              ^
In file included from prog.c:2:
/usr/include/string.h:384:35: note: expected ‘const char *’ but argument is of type ‘int’
 extern size_t strlen (const char *__s)
                       ~~~~~~~~~~~~^~~
prog.c:9:14: warning: passing argument 1 of ‘strlen’ makes pointer from integer without a cast [-Wint-conversion]
  blen=strlen(b);
              ^
In file included from prog.c:2:
/usr/include/string.h:384:35: note: expected ‘const char *’ but argument is of type ‘int’
 extern size_t strlen (const char *__s)
                       ~~~~~~~~~~~~^~~
prog.c:5:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%[^\n]s",a);
  ^~~~~~~~~~~~~~~~~~
prog.c:6:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%[^\n]s",b);
  ^~~~~~~~~~~~~~~~~~
stdout
Standard output is empty