criyle/codenet-compile-errors huggingface dataset:
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    int n, a[101];
    int i, j;
    int min, tmp;
    int cnt = 0;

    scanf("%d", &n);

    for (i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }

    for (i = 0; i < n; i++){
        min = i;
        for (j = i; j < n; j++){
            if (a[j] < a[min]){
                min = j;
            }
        }
        if (min != i){
            tmp = a[i];
            a[i] = a[min];
            a[min] = tmp;
            cnt++;
        }
    }

    for (i = 0; i < n; i++){
        printf("%d", a[i]);
        if (i != n - 1){
            printf(" ");
    }
    printf("\n");
    printf("%d\n", cnt);

    return (0);
}

Compiler output:
main.c: In function 'main':
main.c:42:1: error: expected declaration or statement at end of input
   42 | }
      | ^
Language: C

#include <stdio.h>
int main(){
????int i,j,N,A[100],tmp,count=0,min;
????scanf("%d",&N);
????for(i = 0; i < N; i++){
????????scanf("%d",&A[i]);
????}
????for(i = 0; i < N; i++){
????????min = i;
????????for(j = i; j < N; j++){
????????????if(A[j] < A[min]){
????????min = j;
????????????}
????????}?? 
????????tmp = A[i];
????????A[i] = A[min];
????????A[min] = tmp;
????????if(min != i){
????????????count++;
????????} 
????}
????for(i = 0; i < N-1; i++){
????????printf("%d ",A[i]);
????}
????printf("%d\n",A[i]);
????printf("%d\n",count);
??
????return 0;
}

Compiler output:
main.c: In function 'main':
main.c:3:1: error: expected expression before '?' token
    3 | ????int i,j,N,A[100],tmp,count=0,min;
      | ^
main.c:4:1: error: expected expression before '?' token
    4 | ????scanf("%d",&N);
      | ^
main.c:4:17: error: 'N' undeclared (first use in this function)
    4 | ????scanf("%d",&N);
      |                 ^
main.c:4:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:1: error: expected expression before '?' token
    5 | ????for(i = 0; i < N; i++){
      | ^
main.c:26:1: error: expected expression before '?' token
   26 | ????printf("%d\n",count);
      | ^
main.c:26:19: error: 'count' undeclared (first use in this function)
   26 | ????printf("%d\n",count);
      |                   ^~~~~
main.c:27:1: error: expected expression before '?' token
   27 | ??
      | ^
Language: C

#include <stdio.h>
#include <stdlib.h>
#define swap(a, b) {int t; t=a; a=b; b=t;}

int main()
{
  int *a;
  int n, i, j, min, ans=0;
  scanf("%d", &n);
  a = (int *)malloc(sizeof(int)*n);
  
  for(i=0; i<n; i++){
    scanf("%d", a+i);
  }

  for(i=0; i<n-1; i++){
    min=i;
    for(j=i; j<n; j++){
      if(a[min] > a[j]) min=j;
    }
    if(min != i){
      swap(a[i], a[min]);
      ans++;
    }
  }
  printf("%d", a[0]);
  for(i=1; i<n; i++){
    printf(" %d", a[i]);
  }
  printf("\n%d\n", ans);

Compiler output:
main.c: In function 'main':
main.c:30:3: error: expected declaration or statement at end of input
   30 |   printf("\n%d\n", ans);
      |   ^~~~~~
Language: C

#include <stdio.h>
#define MAX 100

int main(void){
 int A[MAX]={0},N,S=0;
 int a,b,c,min,tmp;

 scanf("%d",&N);

 for(a=0;a<N;a++){
  scanf("%d "&A[a]);
 }

 for(b=0;b<N;b++){
  min=b;
  for(c=b;c<N;c++){
   if(A[c]<A[min]){min=c;S++;}
   tmp=A[b];
   A[b]=A[min];
   A[min]=tmp;
  }
 }

 for(a=0;a<N;a++){
  printf("%d",A[a]);
  if(a!=N){printf(" ");}
 }
 
 printf("\n%d\n",S);
 
 return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:14: error: invalid operands to binary & (have 'char *' and 'int')
   11 |   scanf("%d "&A[a]);
      |         ~~~~~^~~~~
      |         |      |
      |         char * int
Language: C

// ConsoleApplication2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

int selectionSort(int *, int);

int main()
{
	int i, j, sum,sei[100], num;
	scanf("%d",&sum);

	for (i = 0; i < sum; i++)
	{
		scanf("%d",sei[i]);
	}

	num = selectionSort(sei,sum);

	for (i = 0; i < sum; i++)
	{
		printf("%d",sei[i]);
		if (i >= sum - 1)break;
		printf(" ");
	}
	printf("\n%d\n",num);
    return 0;
}

int selectionSort(int A[], int N)
{
	int i, j, k,minj,tmp;
	static int NUM = 0;

	for (i = 0; i < N - 1; i++)
	{
		minj = i;
		for (j = i; j < N - 1; j++)
		{
			if (A[j] < A[minj])
			{
				minj = j;
			}
		}
		tmp = A[i];
		A[i] = A[minj];
		A[minj] = tmp;
		NUM++;
	}
	return NUM;
}

Compiler output:
main.c:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C

include <stdio.h>
#define N 100
int main(){
  int A[N];
  int i,j,n,temp,count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<n;i++){
    for(j=n-1;j>i;j--){
      if(A[j]<A[j-1]){
        temp=A[j];
        A[j]=A[j-1];
        A[j-1]=temp;
        count++;
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d ",A[i]);  }
  printf("\n%d\n",count);
  return 0;
}

Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
Language: C

#include<stdio.h>

main(){
int arr[100],N
int i,sw;

scanf("%d",&N);
for(i=0;i<N;i++)scanf("%d",&arr[i]);

sw=Sort(arr,N);

for(i=0;i<N;i++){
if(i>0)printf(" ");
printf("%d",arr[i]);
}
printf("\n");
printf("%d\n",sw);

return 0;
}

int Sort(int arr[],int N){
int i,j
int k,sw=0;
int minj;

for(j=i;j<N;j++){
if(arr[j]<arr[minj])minj=j;
}
k=arr[i];
arr[i]=arr[minj];
arr[minj]=k;
if(i!=minj)sw++;
}
return sw;
}

Compiler output:
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
    3 | main(){
      | ^~~~
main.c: In function 'main':
main.c:5:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
    5 | int i,sw;
      | ^~~
main.c:7:13: error: 'N' undeclared (first use in this function)
    7 | scanf("%d",&N);
      |             ^
main.c:7:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:5: error: 'i' undeclared (first use in this function)
    8 | for(i=0;i<N;i++)scanf("%d",&arr[i]);
      |     ^
main.c:10:1: error: 'sw' undeclared (first use in this function)
   10 | sw=Sort(arr,N);
      | ^~
main.c:10:4: error: implicit declaration of function 'Sort' [-Wimplicit-function-declaration]
   10 | sw=Sort(arr,N);
      |    ^~~~
main.c: In function 'Sort':
main.c:24:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
   24 | int k,sw=0;
      | ^~~
main.c:27:5: error: 'j' undeclared (first use in this function)
   27 | for(j=i;j<N;j++){
      |     ^
main.c:30:1: error: 'k' undeclared (first use in this function)
   30 | k=arr[i];
      | ^
main.c:33:12: error: 'sw' undeclared (first use in this function)
   33 | if(i!=minj)sw++;
      |            ^~
main.c: At top level:
main.c:35:1: error: expected identifier or '(' before 'return'
   35 | return sw;
      | ^~~~~~
main.c:36:1: error: expected identifier or '(' before '}' token
   36 | }
      | ^
Language: C

#include<stdio.h>

main(){
int arr[100],N;
int i,sw;

scanf("%d",&N);
for(i=0;i<N;i++)scanf("%d",&arr[i]);

sw=Sort(arr,N);

for(i=0;i<N;i++){
if(i>0)printf(" ");
printf("%d",arr[i]);
}
printf("\n");
printf("%d\n",sw);

return 0;
}

int Sort(int arr[],int N){
int i,j
int k,sw=0;
int minj;

for(j=i;j<N;j++){
if(arr[j]<arr[minj])minj=j;
}
k=arr[i];
arr[i]=arr[minj];
arr[minj]=k;
if(i!=minj)sw++;
}
return sw;
}

Compiler output:
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
    3 | main(){
      | ^~~~
main.c: In function 'main':
main.c:10:4: error: implicit declaration of function 'Sort' [-Wimplicit-function-declaration]
   10 | sw=Sort(arr,N);
      |    ^~~~
main.c: In function 'Sort':
main.c:24:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
   24 | int k,sw=0;
      | ^~~
main.c:27:5: error: 'j' undeclared (first use in this function)
   27 | for(j=i;j<N;j++){
      |     ^
main.c:27:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:30:1: error: 'k' undeclared (first use in this function)
   30 | k=arr[i];
      | ^
main.c:33:12: error: 'sw' undeclared (first use in this function)
   33 | if(i!=minj)sw++;
      |            ^~
main.c: At top level:
main.c:35:1: error: expected identifier or '(' before 'return'
   35 | return sw;
      | ^~~~~~
main.c:36:1: error: expected identifier or '(' before '}' token
   36 | }
      | ^
Language: C

#include<stdio.h>

main(){
int arr[100],N;
int i,sw;

scanf("%d",&N);
for(i=0;i<N;i++)scanf("%d",&arr[i]);

sw=Sort(arr,N);

for(i=0;i<N;i++){
if(i>0)printf(" ");
printf("%d",arr[i]);
}
printf("\n");
printf("%d\n",sw);

return 0;
}

int Sort(int arr[],int N){
int i,j;
int k,sw=0;
int minj;

for(j=i;j<N;j++){
if(arr[j]<arr[minj])minj=j;
}
k=arr[i];
arr[i]=arr[minj];
arr[minj]=k;
if(i!=minj)sw++;
}
return sw;
}

Compiler output:
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
    3 | main(){
      | ^~~~
main.c: In function 'main':
main.c:10:4: error: implicit declaration of function 'Sort' [-Wimplicit-function-declaration]
   10 | sw=Sort(arr,N);
      |    ^~~~
main.c: At top level:
main.c:35:1: error: expected identifier or '(' before 'return'
   35 | return sw;
      | ^~~~~~
main.c:36:1: error: expected identifier or '(' before '}' token
   36 | }
      | ^
Language: C

#include <stdio.h>
#include <stdlib.h>
int main(){
  int N,i,j,n,*A,count=0,minj;
  scanf("%d",&N);
  A=(int*)malloc(sizeof(int)*N);
  for(i=0;i<N;i++)
      scanf("%d",&A[i]);
  for(i=0;i<N;i++){
    minj=i;
    for(j=i;j<N;j++){
      if(A[j]<A[minj]){

	minj=j;
      }
    }
    if(i!=minj)???
    count++;
      n=A[i];
      A[i]=A[minj];
      A[minj]=n;}???
  for(i=0;i<N;i++){
    printf("%d",A[i]);
    if(i<N-1)
      printf(" ");
  }
  printf("\n%d\n",count);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:16: error: expected expression before '?' token
   17 |     if(i!=minj)???
      |                ^
main.c:21:18: error: expected expression before '?' token
   21 |       A[minj]=n;}???
      |                  ^
Language: C

int main(){
  int i,j,n,tmp,min,count=0,A[N];

  scanf("%d",&n);
  for(i=0 ; i<n; i++){
    scanf("%d",&A[i]);
  }

  for(i=0 ; i<n-1 ; i++){
    min=i;
    for(j=i ; j<n ; j++){
      if(A[j]<A[min])
	min=j;
    }
    if(min != i)count++;
    
    tmp=A[i];
    A[i]=A[min];
    A[min]=tmp;

  }
  for(i=0 ; i<n ; i++){
    if(i>0)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",count);

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:2:31: error: 'N' undeclared (first use in this function)
    2 |   int i,j,n,tmp,min,count=0,A[N];
      |                               ^
main.c:2:31: note: each undeclared identifier is reported only once for each function it appears in
main.c:4:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    4 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int main(){
main.c:4:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    4 |   scanf("%d",&n);
      |   ^~~~~
main.c:4:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:23:12: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   23 |     if(i>0)printf(" ");
      |            ^~~~~~
main.c:23:12: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:23:12: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:23:12: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:24:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   24 |     printf("%d",A[i]);
      |     ^~~~~~
main.c:24:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:26:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   26 |   printf("\n");
      |   ^~~~~~
main.c:26:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include <stdio.h>
#include <stdlib.h>
int main(){
  int N,*A,i,j,minj,c=0,a=0;

  scanf("%d",&N);

  A=(int*)malloc(N*sizeof(int));

 
  for(i=0;i<N;i++)scanf("%d",&A[i]);

  
  for(i=0;i<N;i++){

    minj=i;
    for(j=i;j<N;j++){
      if(A[j]<A[minj]) minj=j;
        }


    a=A[i];
  
    A[i]=A[minj];
    A[minj]=a;
    if(i!=minj) c++;
  }
  printf("%d",A[0]);
  for(i=1;i<N;i++)printf(" %d",A[i]);
  printf("\n%d\n",c);
  close(A);
  return 0;
  

Compiler output:
main.c: In function 'main':
main.c:31:3: error: implicit declaration of function 'close'; did you mean 'pclose'? [-Wimplicit-function-declaration]
   31 |   close(A);
      |   ^~~~~
      |   pclose
main.c:32:3: error: expected declaration or statement at end of input
   32 |   return 0;
      |   ^~~~~~
Language: C

#include<stdio.h>
#include<stdlib.h>

int main(){

  int i,N,j,minj;
  int A[100];

  scanf("%d",&N);

  for(i=0;i<N;i++)
    scanf("%d",&A[i]);

  for(i=0;i<N;i++){
    minj = i;
    for(j=i;j<N;j++){
      if(A[j]<minj;)minj = j;
    }
    box = A[i];
    A[i] = A[minj];
    A[minj] = box;
  }

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:19: error: expected ')' before ';' token
   17 |       if(A[j]<minj;)minj = j;
      |         ~         ^
      |                   )
main.c:19:5: error: 'box' undeclared (first use in this function)
   19 |     box = A[i];
      |     ^~~
main.c:19:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<stdlib.h>

int main(){

  int i,N,j,minj;
  int A[100];

  scanf("%d",&N);

  for(i=0;i<N;i++)
    scanf("%d",&A[i]);

  for(i=0;i<N;i++){
    minj = i;
    for(j=i;j<N;j++){
      if(A[j]<A[minj])minj = j;
    }
    box = A[i];
    A[i] = A[minj];
    A[minj] = box;
  }

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:5: error: 'box' undeclared (first use in this function)
   19 |     box = A[i];
      |     ^~~
main.c:19:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
void swap(int *a,int *b); 

int main()  {
  int i,j,A[100],N,count=0,minj;
  while(1) {
    scanf("%d",&N);
    if(1<=N && N<=100) break;
  }

  for(i=0;i<N;i++)  {
    scanf("%d",&A[i]);
  }

  for(i = 0;i <=N-1;i++) {
    minj = i;
    for (j = i; j <= N-1; j++) {
      if (A[j] < A[minj]) {
	minj = j; 
      }
    }
	swap(&A[i],&A[minj]);
	if(minj != i) count++;
  }


  for(i=0;i<N-1;i++) 
    printf("%d ",A[i]);
  
  printf("%d\n",A[N-1]);
  printf("%d\n",count);
  return 0;
}

void swap(int *a,int *b)
{ 
  int t; 
  t =*a; 
  *a = *b;
  *b =t

Compiler output:
main.c: In function 'swap':
main.c:40:8: error: expected ';' at end of input
   40 |   *b =t
      |        ^
      |        ;
main.c:40:3: error: expected declaration or statement at end of input
   40 |   *b =t
      |   ^
Language: C

  for ( i = 0; i < n; i++ ){
    if ( i > 0 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main()
{
  int n, i, j, swap, minj, count = 0;
  int A[N];
  scanf("%d", &n);
  for(i = 0; i < n; i++) scanf("%d", &A[i]);

  for(i = 0; i < n-1; i++){

    minj = i;
    for(j =i; j <= n-1; j++){
      if( A[j] < A[minj] ){
	minj = j;
      }
    }
	if(minj != i){
	swap = A[i];
	A[i] = A[minj];
	A[minj] = swap;
	minj = i;
	count++;
	
      }
     
    }
  trace(A, n);
  printf("%d\n", count);  
  
  return 0;
}

  

Compiler output:
main.c:1:3: error: expected identifier or '(' before 'for'
    1 |   for ( i = 0; i < n; i++ ){
      |   ^~~
main.c:1:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 |   for ( i = 0; i < n; i++ ){
      |                  ^
main.c:1:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    1 |   for ( i = 0; i < n; i++ ){
      |                        ^~
main.c:5:10: error: expected declaration specifiers or '...' before string constant
    5 |   printf("\n");
      |          ^~~~
main.c:6:1: error: expected identifier or '(' before '}' token
    6 | }
      | ^
main.c: In function 'main':
main.c:11:9: error: 'N' undeclared (first use in this function)
   11 |   int A[N];
      |         ^
main.c:11:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   12 |   scanf("%d", &n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 |   for ( i = 0; i < n; i++ ){
main.c:12:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   12 |   scanf("%d", &n);
      |   ^~~~~
main.c:12:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:33:3: error: implicit declaration of function 'trace' [-Wimplicit-function-declaration]
   33 |   trace(A, n);
      |   ^~~~~
main.c:34:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   34 |   printf("%d\n", count);
      |   ^~~~~~
main.c:34:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:34:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:34:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include <stdio.h>

int main(){
	int n,i,j,count=0,min,num[10],temp;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&num[i]);
	}
	for(i=0;i<n-1;i++)
	{
		min=i;
		for(j=i+1;j<n;j++)
		{
			if(num[j]<num[min])
			{
				min=j;
			}
		}
		temp=num[i];
		num[i]=num[min];
		num[min]=temp;
		if(num[min]=temp;) count++;
	}
	for(i=0;i<n;i++){
	printf("%d",num[i]);
	if(i!=n-1) printf(" ");
}
printf("\n");
printf("%d\n",count);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:33: error: expected ')' before ';' token
   23 |                 if(num[min]=temp;) count++;
      |                   ~             ^
      |                                 )
Language: C

#include<stdio.h>
 
int main(){
  int n,i,j,flag=0;
  int A[N]=100;
  int num,temp,count=0;
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<n;i++){
    num = i;
    for(j=i;j<n;j++){
      if(A[j]<A[num])
        num = j;
     }  
    if(i!=num){
      temp=A[i];    
      A[i]=A[num];
      A[num]=temp;
      count++;
      }
     }
    for(i=0;i<n;i++){
      if(i<n-1) printf("%d ",A[i]);
      else printf("%d\n",A[i]);
    }
    printf("%d\n",count);  
 
    return 0;
   }

Compiler output:
main.c: In function 'main':
main.c:5:9: error: 'N' undeclared (first use in this function)
    5 |   int A[N]=100;
      |         ^
main.c:5:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
 
int main(){
  int n,i,j,flag=0;
  int A[N]=100,N;
  int num,temp,count=0;
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<n;i++){
    num = i;
    for(j=i;j<n;j++){
      if(A[j]<A[num])
        num = j;
     }  
    if(i!=num){
      temp=A[i];    
      A[i]=A[num];
      A[num]=temp;
      count++;
      }
     }
    for(i=0;i<n;i++){
      if(i<n-1) printf("%d ",A[i]);
      else printf("%d\n",A[i]);
    }
    printf("%d\n",count);  
 
    return 0;
   }

Compiler output:
main.c: In function 'main':
main.c:5:9: error: 'N' undeclared (first use in this function)
    5 |   int A[N]=100,N;
      |         ^
main.c:5:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C

include <stdio.h>

void selectionSort(int *,int);

int main(){
  int N,A[100],i;

  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }

  selectionSort(A,N);

  return 0;

}
void selectionSort(int *a,int n)
{
  int i,j,k,num=0,minj=0,count=0;
  for(i=0;i<n;i++){
    minj = i;
    for(j=i;j<n;j++){
      if(a[j]<a[minj]){
	minj=j;
      }
    }
    if(minj!=i){
	num=a[i];
	a[i]=a[minj];
	a[minj]=num;
       count++;
      }
  }
  for(k=0;k<n;k++){
      printf("%d",a[k]);
      if(k!=n-1)printf(" ");
      }
    printf("\n");
    printf("%d\n",count);
}

Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c: In function 'main':
main.c:8:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    8 |   scanf("%d",&N);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include <stdio.h>
main.c:8:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    8 |   scanf("%d",&N);
      |   ^~~~~
main.c:8:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:13:3: error: implicit declaration of function 'selectionSort' [-Wimplicit-function-declaration]
   13 |   selectionSort(A,N);
      |   ^~~~~~~~~~~~~
main.c: At top level:
main.c:18:6: warning: conflicting types for 'selectionSort'; have 'void(int *, int)'
   18 | void selectionSort(int *a,int n)
      |      ^~~~~~~~~~~~~
main.c:13:3: note: previous implicit declaration of 'selectionSort' with type 'void(int *, int)'
   13 |   selectionSort(A,N);
      |   ^~~~~~~~~~~~~
main.c: In function 'selectionSort':
main.c:36:7: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   36 |       printf("%d",a[k]);
      |       ^~~~~~
main.c:36:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:36:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:36:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:39:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   39 |     printf("\n");
      |     ^~~~~~
main.c:39:5: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include<stdio.h>
#define N 100
int main(){
int n,i,j,temp,mini,count=0;
int A[N];

scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d",&A[i]);

for(i=0;i<n-1;i++){
mini=i;
for(j=n-1;j>i;j--){
if(A[j]<A[mini]){
mini=j;
}
if(i!=mini){
temp=A[j];
A[j]=A[j-1];
A[j-1]=temp;
count++;
}
}

for(i=0;i<n;i++){
printf("%d",A[i]);
if(i!=n-1) printf(" ");
}
printf("\n");
printf("%d\n",count);

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:32:1: error: expected declaration or statement at end of input
   32 | }
      | ^
Language: C

#include<stdio.h>
#include<stdlib.h>

int main(){
  int N, i, j, tmp, minj,  t=0;
  int A[100];

  scanf("%d",&N);
  if( N<1 || 100<N ) exit(1);

  for( i=0 ; i<N ; i++ ){
    scanf("%d",&A[i]);
    if( A[i]<0 || 100<a[i] ) exit(1);
  }

  for( i=0 ; i<N ; i++ ){
    minj = i;

    for( j=i ; j<N ; j++ ){
      if( A[j] < A[minj] ) minj = j;
    }

    if(minj != i){
      tmp = A[i];
      A[i] = A[minj];
      A[minj] = tmp;
      t++;
    }
  }

  for( i=0 ; i<N-1 ; i++ ){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[i]);
  printf("%d\n",t);

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:23: error: 'a' undeclared (first use in this function)
   13 |     if( A[i]<0 || 100<a[i] ) exit(1);
      |                       ^
main.c:13:23: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
 
int N,A[100],m=0,i,j,k;
 
int main()
{
    for(i=0,scanf("%d",&N);i<N;scanf("%d",&A[i++]));
    for(i=0;i<N;i++)
    {
        for(k=j=i;j<N;j++)
            if(A[j]<A[k])
                t=j;
        if(i!=k)
        {
            A[i]^=A[k]^=A[i]^=A[k];
            m++;
        }
    }
    for(i=0;i<N;i++)
        printf("%d%s",A[i],i==N-1?"\n":" ");
    printf("%d\n",m);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:17: error: 't' undeclared (first use in this function)
   12 |                 t=j;
      |                 ^
main.c:12:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdint.h>
#include <stdio.h>
#define BUF_SIZE 256

#define UTIL_SWAP(x, y)                                                                                                                    \
  do {                                                                                                                                     \
    typeof(x) _a = x;                                                                                                                      \
    x = y;                                                                                                                                 \
    y = _a;                                                                                                                                \
  } while (0)

uint32_t selection_sort(int32_t buf[], size_t size)
{
  uint32_t count = 0;

  uint32_t i;
  for (i = 0; i < size; i++) {
    uint32_t min_idx = i;
    uint32_t j;
    for (j = i + 1; j < size; j++) {
      if (buf[j] < buf[min_idx]) {
        min_idx = j;
      }
    }

    if (i != min_idx) {
      UTIL_SWAP(buf[i], buf[min_idx]);
      count++;
    }
  }

  return count;
}

#if !defined(TEST)
int32_t main(void)
{
  int32_t num;
  scanf("%d", &num);
  int32_t buf[BUF_SIZE];
  uint32_t i;
  for (i = 0; i < num; i++) {
    scanf("%d", &buf[i]);
  }

  uint32_t count = selection_sort(buf, num);

  UTIL_PRINT_ARRAY(buf, num);
  printf("%d", count);

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:48:3: error: implicit declaration of function 'UTIL_PRINT_ARRAY' [-Wimplicit-function-declaration]
   48 |   UTIL_PRINT_ARRAY(buf, num);
      |   ^~~~~~~~~~~~~~~~
main.c: At top level:
main.c:35: error: unterminated #if
   35 | #if !defined(TEST)
Language: C

#include <stdint.h>
#include <stdio.h>
#define BUF_SIZE 256

#define UTIL_SWAP(x, y)                                                                                                                    \
  do {                                                                                                                                     \
    typeof(x) _a = x;                                                                                                                      \
    x = y;                                                                                                                                 \
    y = _a;                                                                                                                                \
  } while (0)

uint32_t selection_sort(int32_t buf[], size_t size)
{
  uint32_t count = 0;

  uint32_t i;
  for (i = 0; i < size; i++) {
    uint32_t min_idx = i;
    uint32_t j;
    for (j = i + 1; j < size; j++) {
      if (buf[j] < buf[min_idx]) {
        min_idx = j;
      }
    }

    if (i != min_idx) {
      UTIL_SWAP(buf[i], buf[min_idx]);
      count++;
    }
  }

  return count;
}
#endif
#if !defined(TEST)
int32_t main(void)
{
  int32_t num;
  scanf("%d", &num);
  int32_t buf[BUF_SIZE];
  uint32_t i;
  for (i = 0; i < num; i++) {
    scanf("%d", &buf[i]);
  }

  uint32_t count = selection_sort(buf, num);

  UTIL_PRINT_ARRAY(buf, num);
  printf("%d", count);

  return 0;
}

Compiler output:
main.c:34:2: error: #endif without #if
   34 | #endif
      |  ^~~~~
main.c: In function 'main':
main.c:48:3: error: implicit declaration of function 'UTIL_PRINT_ARRAY' [-Wimplicit-function-declaration]
   48 |   UTIL_PRINT_ARRAY(buf, num);
      |   ^~~~~~~~~~~~~~~~
main.c: At top level:
main.c:35: error: unterminated #if
   35 | #if !defined(TEST)
Language: C

#include <stdint.h>
#include <stdio.h>
#define BUF_SIZE 256

#define UTIL_SWAP(x, y)                                                                                                                    \
  do {                                                                                                                                     \
    typeof(x) _a = x;                                                                                                                      \
    x = y;                                                                                                                                 \
    y = _a;                                                                                                                                \
  } while (0)

uint32_t selection_sort(int32_t buf[], size_t size)
{
  uint32_t count = 0;

  uint32_t i;
  for (i = 0; i < size; i++) {
    uint32_t min_idx = i;
    uint32_t j;
    for (j = i + 1; j < size; j++) {
      if (buf[j] < buf[min_idx]) {
        min_idx = j;
      }
    }

    if (i != min_idx) {
      UTIL_SWAP(buf[i], buf[min_idx]);
      count++;
    }
  }

  return count;
}

#if !defined(TEST)
int32_t main(void)
{
  int32_t num;
  scanf("%d", &num);
  int32_t buf[BUF_SIZE];
  uint32_t i;
  for (i = 0; i < num; i++) {
    scanf("%d", &buf[i]);
  }

  uint32_t count = selection_sort(buf, num);

  UTIL_PRINT_ARRAY(buf, num);
  printf("%d", count);

  return 0;
}
#endif

Compiler output:
main.c: In function 'main':
main.c:48:3: error: implicit declaration of function 'UTIL_PRINT_ARRAY' [-Wimplicit-function-declaration]
   48 |   UTIL_PRINT_ARRAY(buf, num);
      |   ^~~~~~~~~~~~~~~~
Language: C

#include<stdio.h>
int main(void)
{
	int a[100];
	int N,i,j,minj,x;
	int cunt=0;
	
	scanf("%d",&N);
	for(i=0;i<N;i++)scanf("%d",&a[i]);
	
	for(i=0;i<N;i++){
		mnj=i;
		for(j=i;j<N;j++){
			if(a[j]<a[minj]){
				minj=j;
				x=a[j];
				a[j]=a[minj];
				a[minj]=x;
				cunt++;
			}
		}
	}
	for(i=0;i<N;i++){
		if(i>0)printf(" ");
		printf("%d",a[i]);
	}
	printf("\n%d\n",cunt);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:17: error: 'mnj' undeclared (first use in this function); did you mean 'minj'?
   12 |                 mnj=i;
      |                 ^~~
      |                 minj
main.c:12:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int selectionsort(int a[],int n){
	int i,j,t,sw=0,minj;
	for(i=0;i<n-1;i++){
		minj=i;
		for(j=i;j<n;j++){
			if(a[j]<a[minj])minj=j;
		}
		t=a[i];a[i]=a[minj]a[minj]=t;
			if(i!=minj sw++;
			}
		return sw;
	}
	int main(){
		int a[100],n,i,sw;
		
		scanf("%d",&n);
		for(i=0;i<n;i++){
			scanf("%d",&a[i]);
		}
		sw=selectionsort(a,n);
		for(i=0;i<n;i++){
			if(i>0){
				printf("%d",a[i]);
			}
		}
			printf("\n");
			printf("%d\n",sw);
			
			return 0;
	}
			

Compiler output:
main.c: In function 'selectionsort':
main.c:10:36: error: expected ';' before 'a'
   10 |                 t=a[i];a[i]=a[minj]a[minj]=t;
      |                                    ^
      |                                    ;
main.c:11:35: error: expected ')' before 'sw'
   11 |                         if(i!=minj sw++;
      |                           ~       ^~~
      |                                   )
main.c:12:25: error: expected expression before '}' token
   12 |                         }
      |                         ^
Language: C

#include <stdio.h>

int selectionsort(int A[],int N)
{
	int i,j,t,minj;
	int count = 0;
	
	for(i = 0; i < N - 1; i++)
	{
		minj = i;
		for(j = 0; j = N - 1; j++)
		{
			if(A[j] < A[minj])
			{
				minj = j;
			}
		}
		
		t = 0;
		t = A[minj];
		A[minj] = A[i];
		A[i] = t;
		count++;
	}
	
int main()
{
	int A[100],N,count;
	int i.j;
	
	scanf("%d",&N);
	
	for(i = 0; i < N - 1; i++)
	{
		scanf("%d",A + i);
	}
	
	count = selectionsort(A,N);
	
	for(i = 0; i < N - 1; i++)
	{
		if(i)
		{
			printf(" ");
		}
		
		printf("%d",A[i]);
	}
	printf("\n");
	
	printf("%d\n",count);
	
	return 0;
}
	

Compiler output:
main.c: In function 'main':
main.c:29:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
   29 |         int i.j;
      |              ^
main.c:29:14: error: expected expression before '.' token
main.c: In function 'selectionsort':
main.c:54:1: error: expected declaration or statement at end of input
   54 | }
      | ^
Language: C

#include<stdio.h>
int delectionSort(int A[],int N){
	int i,j,t,sw=0,mini;
	for(i=0;i<N-1;i++){
		mini=1;
		for(j=i;j<N;j++){
			if(A[j]<A[mini]) mini=j;
		}
		t=A[i]; A[i]=A[mini]; A[mini]=t;
		if(i!=mini) sw++;
	}
	return sw;
}

int main(){
	int A[100],N,i,sw;
	scanf("%d",&N);
	for(i=0;i<N;i++) scanf("%d",&A[i]);
	sw=selectionSort(A,N);
	for(i=0;i<N;i++){
		if(i>0) orintf(" ");
		printf("%d",A[i]);
	}
	printf("\n");
	printf("%d\n",sw);
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:12: error: implicit declaration of function 'selectionSort'; did you mean 'delectionSort'? [-Wimplicit-function-declaration]
   19 |         sw=selectionSort(A,N);
      |            ^~~~~~~~~~~~~
      |            delectionSort
main.c:21:25: error: implicit declaration of function 'orintf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   21 |                 if(i>0) orintf(" ");
      |                         ^~~~~~
      |                         printf
Language: C

#include<stdio.h>


int selectionSort(int A[],int N){
	int i,j,t,sw=0,mini;
	for(i=0;i<N-1;i++){
		mini=i;
		for(j=i;j<N;j++){
			if(A[j]<A[mini])mini=j;
		}
		t=A[i];A[i]=A[mini];A[mini]=t;
		if(i!=mini)sw++;
	}
	return sw;
}

int main(){
	int A[100],N,i,sw;
	
	scanf("%d",&N);
	for(i=0;i<N;i++)scanf("%d",&A[i]);
	
	sw=selectionSort)(A,N);
	
	for(i=0;i<N;i++){
		if(i>0)printf(" ");
		printf("%d",A[i]);
	}
	printf("\n");
	printf("%d\n",sw);
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:11: error: assignment to 'int' from 'int (*)(int *, int)' makes integer from pointer without a cast [-Wint-conversion]
   23 |         sw=selectionSort)(A,N);
      |           ^
main.c:23:25: error: expected ';' before ')' token
   23 |         sw=selectionSort)(A,N);
      |                         ^
      |                         ;
main.c:23:25: error: expected statement before ')' token
Language: C

#include<stdio.h>


int selectionSort(int A[],int N){
	int i,j,t,sw=0,mini;
	for(i=0;i<N-1;i++){
		mini=i;
		for(j=i;j<N;j++){
			if(A[j]<A[mini])mini=j;
		}
		t=A[i];A[i]=A[mini];A[mini]=t;
		if(i!=mini)sw++;
	}
	return sw;
}

int main(){
	int A[100],N,i,sw;
	
	scanf("%d",&N);
	for(i=0;i<N;i++)scanf("%d",&A[i]);
	
	sw=selectionSort(A,N);
	
	for(i=0;i<N;i++){
		if(i>0)printf(" ");
		printf("%d",A[i]);
	}
	printf("\n");
	printf("%d\n",sw);
	

Compiler output:
main.c: In function 'main':
main.c:30:9: error: expected declaration or statement at end of input
   30 |         printf("%d\n",sw);
      |         ^~~~~~
Language: C

#include<stdio.h>

int selectionSort(int A,int N){
	int i,minj,j,x,cnt = 0;
	for(i = 0,i < N - 1;i++){
		minj = i;
		for(j = i;j < N - 1;j++){
			if(A[j] < A[minj]){
				minj = j;
			}
		}
		x = A[i];
		A[i] = A[minj];
		A[minj] = x;
		
		if(i != minj) cnt++;
	}
	return cnt;
}
		
int main(void){		
	int A[100];
	int N,i,cnt;
	scanf("%d",N);
	for(i = 0;i < N;i++){
		scanf("%d",&A[i]);
	}
	cnt = selectionSort(int A,int N);
	
	for(i = 0;i < N;i++){
		if(i > 0) printf(" ");
		printf("%d",A[i]);
	}
	printf("\n");
	printf("%d\n",cnt);
	
	return 0;
}

Compiler output:
main.c: In function 'selectionSort':
main.c:5:32: error: expected ';' before ')' token
    5 |         for(i = 0,i < N - 1;i++){
      |                                ^
      |                                ;
main.c:8:29: error: subscripted value is neither array nor pointer nor vector
    8 |                         if(A[j] < A[minj]){
      |                             ^
main.c:8:36: error: subscripted value is neither array nor pointer nor vector
    8 |                         if(A[j] < A[minj]){
      |                                    ^
main.c:12:22: error: subscripted value is neither array nor pointer nor vector
   12 |                 x = A[i];
      |                      ^
main.c:13:18: error: subscripted value is neither array nor pointer nor vector
   13 |                 A[i] = A[minj];
      |                  ^
main.c:13:25: error: subscripted value is neither array nor pointer nor vector
   13 |                 A[i] = A[minj];
      |                         ^
main.c:14:18: error: subscripted value is neither array nor pointer nor vector
   14 |                 A[minj] = x;
      |                  ^
main.c: In function 'main':
main.c:28:29: error: expected expression before 'int'
   28 |         cnt = selectionSort(int A,int N);
      |                             ^~~
main.c:28:15: error: too few arguments to function 'selectionSort'
   28 |         cnt = selectionSort(int A,int N);
      |               ^~~~~~~~~~~~~
main.c:3:5: note: declared here
    3 | int selectionSort(int A,int N){
      |     ^~~~~~~~~~~~~
Language: C

#include<stdio.h>
 int selectionSort(intA[],intN)
 {
 	inti,j,t,sw=01,minj;
 	for(i=0;i<N-1;i++)
 	{
 		minj=i;
 		for(j=i;j<N;j++)
 		{
 			if(A[j]<A[minj])
 			{
 				minj=i;
 			}
 			t=A[i];A[i]=A[minj];A[minj]=t;
 			if(i!=minj)
 			{
 				sw++;
 			}
 		}
 		return sw;
 	}
 	
 int main()
 {
 int A[100],N,i,sw;
 
 scanf("%d",&N);
 for(i=0;i<N;i++)
 {
 	scanf("%d",&A[i]);
 }
 
 	sw=selectionSort(A,N);
 	
 	for(i=0;i<N;i++)
 	{
 		if(i>0)
 		{
 			printf("");
 		}
 		
 		printf("%d",A[i]);
 	}
 	
 	printf("\n");
 	printf("%d\n",sw);
 	
 return 0;
 }

Compiler output:
main.c:2:20: error: unknown type name 'intA'; did you mean 'int'?
    2 |  int selectionSort(intA[],intN)
      |                    ^~~~
      |                    int
main.c:2:27: error: unknown type name 'intN'; did you mean 'int'?
    2 |  int selectionSort(intA[],intN)
      |                           ^~~~
      |                           int
Language: C

#include<stdio.h>
 int selectionSort(intA[],intN)
 {
 	inti,j,t,sw=0,minj;
 	for(i=0;i<N-1;i++)
 	{
 		minj=i;
 		for(j=i;j<N;j++)
 		{
 			if(A[j]<A[minj])
 			{
 				minj=i;
 			}
 			t=A[i];A[i]=A[minj];A[minj]=t;
 			if(i!=minj)
 			{
 				sw++;
 			}
 		}
 		return sw;
 	}
 	
 int main()
 {
 int A[100],N,i,sw;
 
 scanf("%d",&N);
 for(i=0;i<N;i++)
 {
 	scanf("%d",&A[i]);
 }
 
 	sw=selectionSort(A,N);
 	
 	for(i=0;i<N;i++)
 	{
 		if(i>0)
 		{
 			printf("");
 		}
 		
 		printf("%d",A[i]);
 	}
 	
 	printf("\n");
 	printf("%d\n",sw);
 	
 return 0;
 }

Compiler output:
main.c:2:20: error: unknown type name 'intA'; did you mean 'int'?
    2 |  int selectionSort(intA[],intN)
      |                    ^~~~
      |                    int
main.c:2:27: error: unknown type name 'intN'; did you mean 'int'?
    2 |  int selectionSort(intA[],intN)
      |                           ^~~~
      |                           int
Language: C

#include<stdio.h>

int Sort(int A[],int N){
	int i,j,t,sw=0,mini;
	for(i=0;i<N;i++){
		mini=i;
		for(j=i;j<N;j++){
			if(A[j]<A[mini])mini=j;
		}
		t=A[i];A[i]=A[mini];A[mini]=t;
		if(i!=mini)sw++;
	}
	return sw;
}

int main(){
	int A[100],N,i,sw;
	
	scanf("%d",&N);
	for(i=0;i<N;i++)scanf("%d",&A[i]);
	
	sw=Sort(A,N);
	
	for(i=0;I<N;i++){
		if(i>0)printf(" ");
		printf("%d",A[i]);
	}
	printf("\n");
	printf("%d\n",sw);
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:24:17: error: 'I' undeclared (first use in this function)
   24 |         for(i=0;I<N;i++){
      |                 ^
main.c:24:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int selectionSort(int A[], int N){
	int i,j,t,sw=0,minj;
	
	for(i=0; i<N-1; i++){
		minj=i;
		
		for(j=i; j<N; j++){
			if( A[j]<A[minj] ){
				minj=j;
			}
		}
			t=A[i];
			A[i]=A[minj];
			A[minj]=t;
			
			if(i != minj){sw++;}
		}
	return sw;

}

int main(void)
{
	int A[100],N,i,sw;
	
	scanf("%d",&N);
	
	for(i=0; i<N; i++){
		scanf("%d",&A[i]);
	}
	
	sw = selectionSort(A,N)
	
	for(i=0; i<N; i++){
			if(i>0){printf(" ");}
		printf("%d",A[i]);
	}
	printf("\n");
	printf("%d\n",sw);
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:34:32: error: expected ';' before 'for'
   34 |         sw = selectionSort(A,N)
      |                                ^
      |                                ;
   35 | 
   36 |         for(i=0; i<N; i++){
      |         ~~~
Language: C

#include <stdio.h>

int main()
{
 int n,a[1000],i,j,mini,temp;
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {
  scanf("%d",&a[i]);
 }

 for (i = 0;i<n;i++)
 {    mini = i
      for (j = i;j<n;j++)
      {
        if (a[j] < a[mini])
              mini = j;
      }
      temp=a[i];
      a[i]=a[mini]
      a[mini]=temp;      
 }
 return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:15: error: expected ';' before 'for'
   13 |  {    mini = i
      |               ^
      |               ;
   14 |       for (j = i;j<n;j++)
      |       ~~~      
main.c:20:19: error: expected ';' before 'a'
   20 |       a[i]=a[mini]
      |                   ^
      |                   ;
   21 |       a[mini]=temp;
      |       ~
Language: C

#include <stdio.h>

int main()
{
 int n,a[1000],i,j,mini,temp;
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {
  scanf("%d",&a[i]);
 }

 for (i = 0;i<n;i++)
 {    mini = i
      for (j = i;j<n;j++)
      {
        if (a[j] < a[mini])
              mini = j;
      }
      temp=a[i];
      a[i]=a[mini];
      a[mini]=temp;      
 }
 return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:15: error: expected ';' before 'for'
   13 |  {    mini = i
      |               ^
      |               ;
   14 |       for (j = i;j<n;j++)
      |       ~~~
Language: C

#include <stdio.h>

int main()
{
 int n,a[1000],i,j,mini,temp,dem=0;
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {
  scanf("%d",&a[i]);
 }

 for (i = 0;i<n;i++)
 {    mini = i;
      for (j = i;j<n;j++)
      {
        if (a[j] < a[mini])
           {
             mini = j;
             temp=a[i];
             a[i]=a[mini];
             a[mini]=temp;      
             dem++;
           }
      }
 }
 for(i=0;i<n;i++)
 {
  printf("%d",a[i]);
 }
 printf("%d",dem)
 return 0;
}

Compiler output:
main.c: In function 'main':
main.c:30:18: error: expected ';' before 'return'
   30 |  printf("%d",dem)
      |                  ^
      |                  ;
   31 |  return 0;
      |  ~~~~~~
Language: C

#include<stdio.h>

int main(void)
{
int N,i,mini,j,swap=0;
scanf("%d\n",&N);
int array[N];
for(i=0;i<N;i++) scanf("%d ",&array[i]);
for(i=0;i<N-1;i++)
{
mini=i;
for(j=i+1;j<N;j++)
{
if(array[j]<array[mini]) mini=j,swap++;
}
array[i]=array[mini]
}
for(i=0;i<N-1;i++) printf("%d ",array[i]);
printf("%d\n%d\n",array[N-1],swap);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:16:21: error: expected ';' before '}' token
   16 | array[i]=array[mini]
      |                     ^
      |                     ;
   17 | }
      | ~
Language: C



  if(i!=minj){
    t=A[i];
    A[i]=A[minj];
    A[minj]=t;
    count++;
  }
 }
}

Compiler output:
main.c:3:3: error: expected identifier or '(' before 'if'
    3 |   if(i!=minj){
      |   ^~
main.c:9:2: error: expected identifier or '(' before '}' token
    9 |  }
      |  ^
main.c:10:1: error: expected identifier or '(' before '}' token
   10 | }
      | ^
Language: C

#include <stdio.h>

#define MAX 101
void selectionSort(int A[],int);

int main(void){
	int A[MAX],i,j,n;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}
	selectionSort(A,n);
	return 0;
}

void selectionSort(int A[],int n){
	int i,j,a,minj,tmp,count;
	
	for(i=0;i<n;i++){
		minj = i;
		for(j=i;j<n;j++){
			if(A[j]<A[minj]){
				minj=j;
			}
		}
		tmp = A[i];
		A[i]=A[minj];
		A[min]=tmp;
		count++;
	}
	for(a=0;a<n;a++){
	printf("%d",A[a]);
	if(a!=n)printf(" ");
	}
	printf("\n%d\n",count);
}

Compiler output:
main.c: In function 'selectionSort':
main.c:28:19: error: 'min' undeclared (first use in this function); did you mean 'minj'?
   28 |                 A[min]=tmp;
      |                   ^~~
      |                   minj
main.c:28:19: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>


void selectionSort(void);

int A[100], n, count=0;

int main(){
  int i;

  scanf("%d", &n);

  for(i = 0; i < n; i++)
    scanf("%d", &A[i]);

  selectionSort();

  for(i = 0; i < n; i++){
    printf("%d", A[i]);
    if(i == n-1) break;
    printf(" ");
  }

  printf("\n%d\n", count);

  return 0;
}

void selectionSort(void){
  int i, j, a, minj;
  for(i = 0; i < n; i++){
    minj = i;
    for(j = i; j < n-1; j++){
      if(A[j] < A[minj])
	minj = j;
    }
    a = A[i];
    A[i] = A[minj];
    A[minj] = a;
    count++;
    }
  }
}

Compiler output:
main.c:43:1: error: expected identifier or '(' before '}' token
   43 | }
      | ^
Language: C

#include <stdio.h>
int main(){
  int n,i,j,temp,min,flag,count = 0;
  int A[100];
  scanf("%d",&n);
  for(i = 0;i < n;i++){
    scanf("%d",&A[i]);
  }
  for(i = 0;i < n;i++){
    min = i;
    for(j = i+1;j < n;j++){
      if(A[j] < A[min])   min = j;
    }
    if(A[i] > A[min]){
      temp = A[i];
      A[i] = A[min];
      A[min] = temp;
      count++;
    }
  }
  for(i = 0 ;i < n;i++){
    printf("%d",A[i]);
    if(i! = n-1) printf(" ");
  }
  printf("\n");
  printf("%d\n",count);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:9: error: expected ')' before '!' token
   23 |     if(i! = n-1) printf(" ");
      |       ~ ^
      |         )
Language: C

#include<stdio.h>

int selectionSort(int A[],int N){
int i,j,t,sw=0,minj;
for(i=0;i<N-1;i++){
i=minj;
for(j=1;j<=i+1;j++){
if(A[j]<A[minj]){
minj=j;
}
t=A[i];A[i]=A[minj];A[minj]=t;
if(i!=minj)sw++;
}
return sw;
}

int main(){
int A[100],N,i,sw;
scanf("%d",&N);
for(i=0;i<N;i++) scanf("%d",&A[i]);
sw=selectionSort(A,N);
for(i=0;i<N;i++){
if(i>0) printf(" ");
printf("%d",A[i]);
}
printf("\n");
printf("%d\n",sw);
}
return 0;
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>

int selectionSort(int A[],int N){
int i,j,t,sw=0,minj;
for(i=0;i<N-1;i++){
i=minj;
for(j=1;j<=i+1;j++){
if(A[j]<A[minj]){
minj=j;
}
t=A[i];A[i]=A[minj];A[minj]=t;
if(i!=minj)sw++;
}
return sw;
}

int main(){
int A[100],N,i,sw;
scanf("%d",&N);
for(i=0;i<N;i++) scanf("%d",&A[i]);
sw=selectionSort(A,N);
for(i=0;i<N;i++){
if(i>0) printf(" ");
printf("%d",A[i]);
}
printf("\n");
printf("%d\n",sw);

return 0;
}

Compiler output:
main.c: In function 'selectionSort':
main.c:30:1: error: expected declaration or statement at end of input
   30 | }
      | ^
Language: C

#include<stdio.h>

int selectionSort(int A[],int N){
int i,j,t,sw=0,minj;
for(i=0;i<N-1;i++){
minj=i;
for(j=1;j<=i+1;j++){
if(A[j]<A[minj]){
minj=j;
}
t=A[i];A[i]=A[minj];A[minj]=t;
if(i!=minj)sw++;
}
return sw;
}

int main(){
int A[100],N,i,sw;
scanf("%d",&N);
for(i=0;i<N;i++) scanf("%d",&A[i]);
sw=selectionSort(A,N);
for(i=0;i<N;i++){
if(i>0) printf(" ");
printf("%d",A[i]);
}
printf("\n");
printf("%d\n",sw);

return 0;
}

Compiler output:
main.c: In function 'selectionSort':
main.c:30:1: error: expected declaration or statement at end of input
   30 | }
      | ^
Language: C

#include<stdio.h>

int selectionSort(int A[],int N){
int i,j,t,sw=0,minj;
for(i=0;i<N-1;i++){
minj=i;
for(j=i;j<N;j++){
if(A[j]<A[minj]){
minj=j;
}
t=A[i];A[i]=A[minj];A[minj]=t;
if(i!=minj)sw++;
}
return sw;
}

int main(){
int A[100],N,i,sw;
scanf("%d",&N);
for(i=0;i<N;i++) scanf("%d",&A[i]);
sw=selectionSort(A,N);
for(i=0;i<N;i++){
if(i>0) printf(" ");
printf("%d",A[i]);
}
printf("\n");
printf("%d\n",sw);

return 0;
}

Compiler output:
main.c: In function 'selectionSort':
main.c:30:1: error: expected declaration or statement at end of input
   30 | }
      | ^