/ SeriousOJ /

Record Detail

Compile Error

foo.c: In function 'main':
foo.c:10:24: error: 'i' undeclared (first use in this function)
   10 |         for(int step=0;i<4;i++){
      |                        ^
foo.c:10:24: note: each undeclared identifier is reported only once for each function it appears in

Code

#include <stdio.h>

int main()
{
    int a,b,c,d;
	int max=a;
	int min=d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	int arr[4]={a,b,c,d};
	for(int step=0;i<4;i++){
		for(int i=0;i<4;i++){
			if(arr[i]>arr[i+1]){
				int temp = arr[i];
				arr[i] = arr[i+1];
				arr[i+1] = temp;
			}
		}
	}
	printf("%d\n",arr[i]);
	printf("%d\n",arr[3]);
}

Information

Submit By
Type
Submission
Problem
P1022 Minmax
Language
C99 (GCC 13.2.0)
Submit At
2025-04-23 13:13:20
Judged At
2025-04-23 13:13:20
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes