Author
anonymous
over 5 years ago
Language
C
Compiler
gcc HEAD 10.0.1 20200119 (experimental)
Options
Warnings
C11(GNU)
no pedantic
Author
anonymous
over 5 years ago
$ gcc prog.c -Wall -Wextra -std=gnu11
prog.c: In function 'main':
prog.c:24:8: warning: unused variable 'avg' [-Wunused-variable]
24 | float avg;// avg là gia tri trung binh
| ^~~
prog.c:23:6: warning: unused variable 'sum' [-Wunused-variable]
23 | int sum;
| ^~~
prog.c:22:8: warning: unused variable 'j' [-Wunused-variable]
22 | int i,j,n,xTimkiem;
| ^
prog.c:20:10: warning: unused variable 'k' [-Wunused-variable]
20 | int max,k;
| ^
prog.c:20:6: warning: unused variable 'max' [-Wunused-variable]
20 | int max,k;
| ^~~
prog.c:96:6: warning: unused variable 'i' [-Wunused-variable]
96 | int i,n;
| ^
prog.c:107:8: warning: unused variable 'i' [-Wunused-variable]
107 | int n,i,j,k;
| ^
prog.c:147:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
147 | for (i=0;i<50;i++);
| ^~~
prog.c:148:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
148 | {sum += a[i];} // sum=sum+a[i];
| ^
prog.c:150:8: error: expected expression before 'float'
150 | avg = float(sum)/i;// giatriTB= tong cac phan tu trong mang chia cho tong so gioi han mang
| ^~~~~
prog.c:151:45: warning: format '%f' expects argument of type 'double', but argument 2 has type 'int' [-Wformat=]
151 | printf("Gia tri trung binh cua mang la: %.2f", avg);
| ~~~^ ~~~
| | |
| | int
| double
| %.2d
prog.c:161:10: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=]
161 | scanf("%d",n);
| ~^ ~
| | |
| | int
| int *
prog.c:158:6: warning: unused variable 'i' [-Wunused-variable]
158 | int i;
| ^
prog.c:177:10: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=]
177 | scanf("%d",n);
| ~^ ~
| | |
| | int
| int *
prog.c:175:6: warning: unused variable 'a' [-Wunused-variable]
175 | int a[50];
| ^
prog.c:185:7: warning: unused variable 'i' [-Wunused-variable]
185 | int n,i;
| ^
prog.c:200:8: warning: unused variable 'i' [-Wunused-variable]
200 | int n,i;
| ^
prog.c:210:5: warning: 'main' is normally a non-static function [-Wmain]
210 | int main(){
| ^~~~
prog.c: In function 'main':
prog.c:217:5: warning: implicit declaration of function 'nhap' [-Wimplicit-function-declaration]
217 | nhap(a,&n);
| ^~~~
prog.c: In function 'main':
prog.c:229:7: warning: unused variable 'i' [-Wunused-variable]
229 | int n,i;
| ^
prog.c:249:62: warning: format '%d' expects a matching 'int' argument [-Wformat=]
249 | printf("\nPhan tu co gia tri lon hon gia tri trung binh la %d ");
| ~^
| |
| int
At top level:
prog.c:210:5: warning: 'main' defined but not used [-Wunused-function]
210 | int main(){
| ^~~~
Exit Code:
1