#include <stdio.h> void main() { int n,t; int b[n]; scanf("%d",n); for(int i=0;i<n;++i) scanf("%d",b[i]); int min=b[0]; int max=b[0]; for(i=0;i<n;++i) { if(b[0]<b[i]) { b[t]=b[0]; b[0]=b[i]; b[i]=b[t]; } if(b[0]>b[i]) { b[t]=b[0]; b[0]=b[i]; b[i]=b[t]; } } for(i=0;i<n;++i) printf("%d",b[i]); } /* Main.c:2:6: warning: return type of 'main' is not 'int' [-Wmain] void main() ^ Main.c: In function 'main': Main.c:6:2: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=] scanf("%d",n); ^ Main.c:8:11: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=] scanf("%d",b[i]); ^ Main.c:11:8: error: 'i' undeclared (first use in this function) for(i=0;i<n;++i) ^ Main.c:11:8: note: each undeclared identifier is reported only once for each function it appears in Main.c:10:8: warning: unused variable 'max' [-Wunused-variable] int max=b[0]; ^ Main.c:9:8: warning: unused variable 'min' [-Wunused-variable] int min=b[0]; ^ */ |
Double click to view unformatted code.