jaehuyng3594   4년 전

숏코딩 보고있었는데

https://www.acmicpc.net/source/8364057

저만 이 에러가 보이나요?

이게 먼가요 ㅎㄷㄷ

Main.c:1:1: warning: data definition has no type or storage class
 a[999];main(t,i,k,y){for(gets(&t);~scanf("%d",&t);printf("%.3f%% ",y*1e2/t)){for(k=i=y=0;i<t;k+=a[i++])scanf("%d",a+i);for(;i;a[--i]>k/t&&y++);}}
 ^
Main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘a’ [-Wimplicit-int]
Main.c:1:8: warning: return type defaults to ‘int’ [-Wimplicit-int]
 a[999];main(t,i,k,y){for(gets(&t);~scanf("%d",&t);printf("%.3f%% ",y*1e2/t)){for(k=i=y=0;i<t;k+=a[i++])scanf("%d",a+i);for(;i;a[--i]>k/t&&y++);}}
        ^~~~
Main.c: In function ‘main’:
Main.c:1:8: warning: type of ‘t’ defaults to ‘int’ [-Wimplicit-int]
Main.c:1:8: warning: type of ‘i’ defaults to ‘int’ [-Wimplicit-int]
Main.c:1:8: warning: type of ‘k’ defaults to ‘int’ [-Wimplicit-int]
Main.c:1:8: warning: type of ‘y’ defaults to ‘int’ [-Wimplicit-int]
Main.c:1:26: warning: implicit declaration of function ‘gets’ [-Wimplicit-function-declaration]
 a[999];main(t,i,k,y){for(gets(&t);~scanf("%d",&t);printf("%.3f%% ",y*1e2/t)){for(k=i=y=0;i<t;k+=a[i++])scanf("%d",a+i);for(;i;a[--i]>k/t&&y++);}}
                          ^~~~
Main.c:1:36: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
 a[999];main(t,i,k,y){for(gets(&t);~scanf("%d",&t);printf("%.3f%% ",y*1e2/t)){for(k=i=y=0;i<t;k+=a[i++])scanf("%d",a+i);for(;i;a[--i]>k/t&&y++);}}
                                    ^~~~~
Main.c:1:36: warning: incompatible implicit declaration of built-in function ‘scanf’
Main.c:1:36: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
Main.c:1:51: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
 a[999];main(t,i,k,y){for(gets(&t);~scanf("%d",&t);printf("%.3f%% ",y*1e2/t)){for(k=i=y=0;i<t;k+=a[i++])scanf("%d",a+i);for(;i;a[--i]>k/t&&y++);}}
                                                   ^~~~~~
Main.c:1:51: warning: incompatible implicit declaration of built-in function ‘printf’
Main.c:1:51: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
Main.c:1:137: warning: value computed is not used [-Wunused-value]
 a[999];main(t,i,k,y){for(gets(&t);~scanf("%d",&t);printf("%.3f%% ",y*1e2/t)){for(k=i=y=0;i<t;k+=a[i++])scanf("%d",a+i);for(;i;a[--i]>k/t&&y++);}}
                                                                                                                                         ^~
/tmp/ccfQ6tlD.o: In function `main':
Main.c:(.text.startup+0x14): warning: the `gets' function is dangerous and should not be used.

djm03178   4년 전

에러가 아니라 워닝입니다. 숏코딩을 위해 권장되지 않는 문법을 많이 사용했기 때문에 발생한 것들입니다.

jaehuyng3594   4년 전

아 다른것들도 봤는데 저런게 있더라고요 ㅋㅋ 파이썬만 하고c알못이라 ㅋㅋㅋ 감사합니다

댓글을 작성하려면 로그인해야 합니다.