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

int main(){
 int a[100];
 int n,i,j,v;
 scanf("%d",&n);
 for(i=0;i<n;i++){
  scanf("%d",&a[i]);
 }
 for(i=0;i<n;i++){
  v = a[i];
  j = i - 1;
  while(j>=0&&A[j]>v){
   a[j+1]=a[j];
   j--;
  }
  a[j+1]=v;
  for(i=0;i<n;i++){
  printf("%d ",a[i]);
 }
 }

}
  
 

Compiler output:
main.c: In function 'main':
main.c:4:2: 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:2: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    4 |  scanf("%d",&n);
      |  ^~~~~
main.c:4:2: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:11:15: error: 'A' undeclared (first use in this function)
   11 |   while(j>=0&&A[j]>v){
      |               ^
main.c:11:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   17 |   printf("%d ",a[i]);
      |   ^~~~~~
main.c:17:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:17:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:17:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include <stdio.h>

int main(){
 int a[100];
 int n,i,j,v,k;
 scanf("%d",&n);
 for(i=0;i<n;i++){
  scanf("%d",&a[i]);
 }
 for(i=0;i<n;i++){
  v=a[i];
  j=i-1;
  while(j>=0&&a[j]>v){
   a[j+1]=a[j];
   j--;
  }
  a[j+1]=v;
  for(k=0;k<n;k++){
     if(k=!n-1){
        printf("%d ",a[k]);
       }else{
        printf("%d\n",a[k]);
  }
  
 }

}

  
 

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

#include <stdio.h>

int main(){
 int a[100];
 int n,i,j,v,k;
 scanf("%d",&n);
 for(i=0;i<n;i++){
  scanf("%d",&a[i]);
 }
 for(i=0;i<n;i++){
  v=a[i];
  j=i-1;
  while(j>=0&&a[j]>v){
   a[j+1]=a[j];
   j--;
  }
  a[j+1]=v;
  for(k=0;k<n;k++){
     if(k=n-1){
        printf("%d\n",a[k]);
       }else{
        printf("%d ",a[k]);
  }
  
 }

}

  
 

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

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

void insertionSort(int A[],int N)
void trace(int A[],int N)

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

void insertionSort(int A[],int N){
	int i , j , k;
	
	for(i = 1;i < N;i++){
		v = A[i];
		j = i-1;
		while(j >= 0 && v < A[j] ){
			A[j+1]=A[j]
			j--;
		}
		A[j+1]=v;
		trace(A,N);
}

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



Compiler output:
main.c: In function 'insertionSort':
main.c:7:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
    7 | int main(){
      | ^~~
main.c:15:34: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   15 | void insertionSort(int A[],int N){
      |                                  ^
Language: C

#include <stdio.h>

void insertionSort(int A[],int N);
void trace(int A[],int N);

int main(){

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

void insertionSort(int A[],int N){

	int i , j , k;
	
	for(i = 1;i < N;i++){
		v = A[i];
		j = i-1;
		while(j >= 0 && v < A[j] ){
			A[j+1]=A[j]
			j--;
		}
		A[j+1]=v;
		trace(A,N);
}

void trace(int A[],int N){

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



Compiler output:
main.c: In function 'main':
main.c:11:23: error: expected ';' before 'for'
   11 |         scanf("%d",&N)
      |                       ^
      |                       ;
   12 |         for(i = 0 ; i < N ; i++) scanf("%d" , &A[i]);
      |         ~~~            
main.c: In function 'insertionSort':
main.c:22:17: error: 'v' undeclared (first use in this function)
   22 |                 v = A[i];
      |                 ^
main.c:22:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:36: error: expected ';' before 'j'
   25 |                         A[j+1]=A[j]
      |                                    ^
      |                                    ;
   26 |                         j--;
      |                         ~           
main.c:41:1: error: expected declaration or statement at end of input
   41 | }
      | ^
Language: C

#include <stdio.h>

void insertionSort(int A[],int N);
void trace(int A[],int N);

int main(){

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

void insertionSort(int A[],int N){

	int i , j , k;
	
	for(i = 1;i < N;i++){
		v = A[i];
		j = i-1;
		while(j >= 0 && v < A[j] ){
			A[j+1]=A[j];
			j--;
		}
		A[j+1]=v;
		trace(A,N);
}

void trace(int A[],int N){

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



Compiler output:
main.c: In function 'insertionSort':
main.c:22:17: error: 'v' undeclared (first use in this function)
   22 |                 v = A[i];
      |                 ^
main.c:22:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:41:1: error: expected declaration or statement at end of input
   41 | }
      | ^
Language: C

#include <stdio.h>

void insertionSort(int A[],int N);
void trace(int A[],int N);

int main(){

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

void insertionSort(int A[],int N){

	int i , j ,v;
	
	for(i = 1;i < N;i++){
		v = A[i];
		j = i-1;
		while(j >= 0 && v < A[j] ){
			A[j+1]=A[j];
			j--;
		}
		A[j+1]=v;
		trace(A,N);
}

void trace(int A[],int N){

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



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

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

void insertionSort(int A[],int N)
void trace(int A[],int N)

int main(){

	int N , i , j;
	int A[100];
	
	scanf("%d",&N);
	for(i = 0 ; i < N ; i++) scanf("%d" , &A[i]);
	
	trace(A,N);
	insertionSort(A,N);
	
	return 0;
}

void insertionSort(int A[],int N){

	int i , j , k;
	
	for(i = 1;i < N;i++){
		v = A[i];
		j = i-1;
		while(j >= 0 && v < A[j] ){
			A[j+1]=A[j];
			j--;
		}
		A[j+1]=v;
		trace(A,N);
}

void trace(int A[],int N){

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



Compiler output:
main.c: In function 'insertionSort':
main.c:7:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
    7 | int main(){
      | ^~~
main.c:21:34: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   21 | void insertionSort(int A[],int N){
      |                                  ^
Language: C

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

void insertionSort(int A[],int N)
void trace(int A[],int N)

int main(){

	int N , i , j;
	int A[100];
	
	scanf("%d",&N);
	for(i = 0 ; i < N ; i++) scanf("%d" , &A[i]);
	
	trace(A,N);
	insertionSort(A,N);
	
	return 0;
}

void insertionSort(int A[],int N){

	int i , j , v;
	
	for(i = 1;i < N;i++){
		v = A[i];
		j = i-1;
		while(j >= 0 && v < A[j] ){
			A[j+1]=A[j];
			j--;
		}
		A[j+1]=v;
		trace(A,N);
}

void trace(int A[],int N){

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



Compiler output:
main.c: In function 'insertionSort':
main.c:7:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
    7 | int main(){
      | ^~~
main.c:21:34: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   21 | void insertionSort(int A[],int N){
      |                                  ^
Language: C

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

int main(void){
    int i, j, key, *a, n, k;
    scanf("%d", &n);
    a = (int *)calloc(n, sizeof(int));

    for(i = 0;i < n;i++){
        scanf("%d", &a[i]);
    }
    for(k = 0;k < n;k++){
        printf("%d", a[k]);
        (k < n-1)?printf(" ");: ;
    }
    printf("\n");

    for(i = 1;i < n;i++){
        key = a[i];
        j = i - 1;
        while(j >= 0 && a[j] > key){
            a[j+1] = a[j];
            j--;
        } 
        a[j+1] = key;
        for(k = 0;k < n;k++){
            printf("%d ", a[k]);
        }
        printf("\n");
    }

    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:14:30: error: expected ':' before ';' token
   14 |         (k < n-1)?printf(" ");: ;
      |                              ^
      |                              :
main.c:14:31: error: expected expression before ':' token
   14 |         (k < n-1)?printf(" ");: ;
      |                               ^
Language: C

// ConsoleApplication1.cpp : アプリケーションのエントリ ポイントを定義します。
//
#include "stdafx.h"
/*
void insertionSort(int a[], int n) {
	int i;
	int v;
	int j;
	int k;
	for (i = 1; i<n; i++) {
		v = a[i];
		j = i - 1;
		while (j >= 0 && a[j]>v) {
			a[j + 1] = a[j];
			j--;
			a[j + 1] = v;
	
		}
		for (k = 0; k<n; k++) {

			printf("%d ", a[k]);

		}
		printf("\b\n");
	}


}*/

int main(void)
{
	int a[101];
	int n;
	int i;
	int k;
	int v;
	int j;
	scanf("%d", &n);
	for (i = 0; i<n; i++) {

		scanf("%d", &a[i]);

	}
	for (i = 1; i<n; i++) {
		v = a[i];
		j = i - 1;
		while (j >= 0 && a[j]>v) {
			a[j + 1] = a[j];
			j--;
			a[j + 1] = v;

		}
		for (k = 0; k<n; k++) {

			printf("%d ", a[k]);

		}
		printf("\b\n");
	}


	return 0;
}




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

// ALDS1_1_A
#include <stdio.h>

void insertionSort(int aryA[], int aryN)
{
	int i, j, k;
	int value
	// insertion sort
	// first value sorted
	for(i = 1; i < aryN - 1; i++)
	{
		value = aryA[i];
		j = i - 1;
		while((j >= 0) && (aryA[j] > value))
		{
			aryA[j+1] = aryA[j];
			j--;
		}
		aryA[j+1] = value;
		
		// output
		k = 0;
		while(k < aryN)
		{
			printf("%d", aryA[k]);
			k++;
			if(k >= aryN)
			{
				printf("\n");
			}
			else
			{
				printf(" ");
			}
		}
	}
}

int main(void)
{
	int aryN;
	int aryA[100] = {};
	int i;

	// input
	scanf("%d", &aryN);
	for(i = 0; i < aryN; i++)
	{
		scanf("%d", &aryA[i]);
	}
	
	insertionSort(aryA, aryN);
	
	return;
}



Compiler output:
main.c: In function 'insertionSort':
main.c:10:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'for'
   10 |         for(i = 1; i < aryN - 1; i++)
      |         ^~~
main.c:12:17: error: 'value' undeclared (first use in this function)
   12 |                 value = aryA[i];
      |                 ^~~~~
main.c:12:17: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:54:9: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
   54 |         return;
      |         ^~~~~~
main.c:39:5: note: declared here
   39 | int main(void)
      |     ^~~~
Language: C

#include<stdio.h>

static const int N = 1000;

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

void insertionSort(int A[], int N){
	for (i=1; i<N: ++i){
		v = A[i];
		j = i-1;
		while (j>=0 && A[j] > v){
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = v;
	}
}

int main(){
	int n, i, j;
	int A[N+1];
	scanf("%d", &n);

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

	trace(A, n);

	insertionSort(A, n);

	trace(A, n);

	return 0;
}


Compiler output:
main.c: In function 'insertionSort':
main.c:15:14: error: 'i' undeclared (first use in this function)
   15 |         for (i=1; i<N: ++i){
      |              ^
main.c:15:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:22: error: expected ';' before ':' token
   15 |         for (i=1; i<N: ++i){
      |                      ^
      |                      ;
main.c:16:17: error: 'v' undeclared (first use in this function)
   16 |                 v = A[i];
      |                 ^
main.c:17:17: error: 'j' undeclared (first use in this function)
   17 |                 j = i-1;
      |                 ^
Language: C

/*ALDS1_1_A 挿入ソート*/
#include <stdio.h>

/*配列の要素を順番に出力*/
void trace(int A[], int N){ to continue
   int i;
   for(i = 0 ; i < N ; i++){
      if(i > 0 ) printf(" ");
      printf("%d", A[i]);
   }
   printf("\n");
}

/*挿入ソート*/
void InsertionSort(int A[], int N){
   int i, j, v;
   for(i = 1 ; i < N ; i++){
      v = A[i];
      j = i - 1;

      while(j >= 0 && A[j] > v){
         A[j + 1] = A[j];
         j--;
      }
      A[j + 1] = v;
      
      trace(A, N);
   }
}

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

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

   trace(A, N);
   InsertionSort(A, N);

   return 0;
}



Compiler output:
main.c: In function 'trace':
main.c:5:29: error: 'to' undeclared (first use in this function)
    5 | void trace(int A[], int N){ to continue
      |                             ^~
main.c:5:29: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:31: error: expected ';' before 'continue'
    5 | void trace(int A[], int N){ to continue
      |                               ^~~~~~~~~
      |                               ;
main.c:7:8: error: 'i' undeclared (first use in this function)
    7 |    for(i = 0 ; i < N ; i++){
      |        ^
Language: C

# include <stdio.h>

int main(){
    int N = 0;
    scanf("%d", &N);
    int a[N];
    for(int i=0; i<N; ++i){
        scanf("%d", &a[i]);
    }
    // output if needs
    for(int k = 0; k < N - 1; k++){
        printf("%d ", a[k]);
    }
    printf("%d\n", a[N-1]);
    // your code
    int j = 0; 
    for(int i = 1; i < N; i++){
        if(a[i] < a[i-1]){ // if needs
            int temp = a[i];
            for(j = i - 1; j >= 0 && temp < a[j]; j--){ // shift
                a[j+1] = a[j];
            }
            a[j+1] = temp; // need +1
        }
        for(int k = 0; k < N - 1; k++){
            printf("%d ", a[k]);
        }
        printf("%d\n", a[N-1]);
    }




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

/*16D8104007J 1-A　兼弘真帆　*/
#include<stdio.h>

void insertionSort(int A[],int N);

int main(){
  int N;
  // printf("長さN:"); 
  scanf("%d",&N);
  int A[N];
  int i;

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

}

void insertionSort(int A[],int N){
  int i,j,v,n;
  for(n=0;n<N;n++){
    printf("%d ",A[n]);
  }
  putchar('\n');

  for(i=1;i<N;i++){
    // printf("test2\n");
    v=A[i];
    j=i-1;
    while(j>=0&&A[j]>v){
      A[j+1]=A[j];
      j--;
      // printf("test1\n");
    }
    A[j+1]=v;
    for(n=0;n<N;n++){
      printf("%d",A[n]);
      if(n!=N-1){
	putchar(" ");
    }
    putchar('\n');
  }
}



Compiler output:
main.c: In function 'insertionSort':
main.c:42:17: error: passing argument 1 of 'putchar' makes integer from pointer without a cast [-Wint-conversion]
   42 |         putchar(" ");
      |                 ^~~
      |                 |
      |                 char *
In file included from main.c:2:
/usr/include/stdio.h:618:25: note: expected 'int' but argument is of type 'char *'
  618 | extern int putchar (int __c);
      |                     ~~~~^~~
main.c:46:1: error: expected declaration or statement at end of input
   46 | }
      | ^
Language: C

#include<stdio.h>

void insertionSort(int A[],int N){
    for(i=1;i<N;i++){
        v=A[i];
        j=i-1;
        while(j>=0&&A[j]>v){
            A[j+1] = A[j]:
            j--;
        }
        A[j+1] = v;
    }
}

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


Compiler output:
main.c: In function 'insertionSort':
main.c:4:9: error: 'i' undeclared (first use in this function)
    4 |     for(i=1;i<N;i++){
      |         ^
main.c:4:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:9: error: 'v' undeclared (first use in this function)
    5 |         v=A[i];
      |         ^
main.c:6:9: error: 'j' undeclared (first use in this function)
    6 |         j=i-1;
      |         ^
main.c:8:26: error: expected ';' before ':' token
    8 |             A[j+1] = A[j]:
      |                          ^
      |                          ;
Language: C

#include<stdio.h>

void insertionSort(int A[],int N){
    int i;
    for(i=1;i<N;i++){
        v=A[i];
        j=i-1;
        while(j>=0&&A[j]>v){
            A[j+1] = A[j]:
            j--;
        }
        A[j+1] = v;
    }
}

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


Compiler output:
main.c: In function 'insertionSort':
main.c:6:9: error: 'v' undeclared (first use in this function)
    6 |         v=A[i];
      |         ^
main.c:6:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:9: error: 'j' undeclared (first use in this function)
    7 |         j=i-1;
      |         ^
main.c:9:26: error: expected ';' before ':' token
    9 |             A[j+1] = A[j]:
      |                          ^
      |                          ;
Language: C

#include<stdio.h>

void insertionSort(int A[],int N){
    int i,v;
    for(i=1;i<N;i++){
        v=A[i];
        j=i-1;
        while(j>=0&&A[j]>v){
            A[j+1] = A[j]:
            j--;
        }
        A[j+1]=v;
    }
}

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


Compiler output:
main.c: In function 'insertionSort':
main.c:7:9: error: 'j' undeclared (first use in this function)
    7 |         j=i-1;
      |         ^
main.c:7:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:26: error: expected ';' before ':' token
    9 |             A[j+1] = A[j]:
      |                          ^
      |                          ;
Language: C

#include<stdio.h>

void insertionSort(int A[],int N){
    int i,v,j;
    for(i=1;i<N;i++){
        v=A[i];
        j=i-1;
        while(j>=0&&A[j]>v){
            A[j+1] = A[j]:
            j--;
        }
        A[j+1]=v;
    }
}

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


Compiler output:
main.c: In function 'insertionSort':
main.c:9:26: error: expected ';' before ':' token
    9 |             A[j+1] = A[j]:
      |                          ^
      |                          ;
Language: C

#include<stdio.h>

void insertionSort(int A[],int N){
    int i,v,j;
    for(i=1;i<N;i++){
        v=A[i];
        j=i-1;
        while(j>=0&&A[j]>v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1]=v;
        for(j=0;j<N;j++){
            printf("%d ",A[j]);
        }
        printf("\n");
    }
}

int main(void){
    int A[1000],N,i;
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    for(j=0;j<N;j++){
            printf("%d ",A[j]);
        }
        printf("\n");
    insertionSort(A, N);
}


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

#include<stdio.h>

void insertionSort(int A[],int N){
    int i,v,j;
    for(i=1;i<N;i++){
        v=A[i];
        j=i-1;
        while(j>=0&&A[j]>v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1]=v;
        for(j=0;j<N;j++){
            printf("%d ",A[j]);
        }
        printf("\n");
    }
}

int main(void){
    int A[1000],N,i;
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    for(i=0;j<N;j++){
           printf("%d ",A[j]);
    }
    printf("\n");
    insertionSort(A, N);
}


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

#include<stdio.h>

void insertionSort(int A[],int N){
    int i,v,j;
    for(i=1;i<N;i++){
        v=A[i];
        j=i-1;
        while(j>=0&&A[j]>v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1]=v;
        for(j=0;j<N;j++){
            printf("%d ",A[j]);
        }
        printf("\n");
    }
}

int main(void){
    int A[1000],N,i;
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    for(i=0;j<N;j++){
           printf("%d ",A[i]);
    }
    printf("\n");
    insertionSort(A, N);
}


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

#include<stdio.h>


insertionSort(A[],N){
    int v,j;
    
    for(i=1;i<N;i++){
        v = A[i];
        j = i-1;
        
        while((j >= 0) && (A[j] > v)){
            A[j+1] = A[j];
            j--;
            A[j+1] = v;
        }
        
        
        for(j=0;j<N;j++){
            printf("%d",A[i]);
            if(j != N-1) printf(" ");
        }
    }
}

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


Compiler output:
main.c:4:15: error: unknown type name 'A'
    4 | insertionSort(A[],N){
      |               ^
main.c:4:19: error: unknown type name 'N'
    4 | insertionSort(A[],N){
      |                   ^
main.c: In function 'main':
main.c:31:9: error: 'i' undeclared (first use in this function)
   31 |     for(i=0;i<N;i++){
      |         ^
main.c:31:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>


void insertionSort(int A[],int N){
    int v,j;
    
    for(i=1;i<N;i++){
        v = A[i];
        j = i-1;
        
        while((j >= 0) && (A[j] > v)){
            A[j+1] = A[j];
            j--;
            A[j+1] = v;
        }
        
        
        for(j=0;j<N;j++){
            printf("%d",A[i]);
            if(j != N-1) printf(" ");
        }
    }
}

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


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

#include<stdio.h>


void insertionSort(int A[],int N){
    int i,v,j;
    
    for(i=1;i<N;i++){
        v = A[i];
        j = i-1;
        
        while((j >= 0) && (A[j] > v)){
            A[j+1] = A[j];
            j--;
            A[j+1] = v;
        }
        
        
        for(j=0;j<N;j++){
            printf("%d",A[i]);
            if(j != N-1) printf(" ");
        }
    }
}

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


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

#include<stdio.h>


void insertionSort(int A[],int N){
    int i,v,j;
    
    for(i=1;i<N;i++){
        v = A[i];
        j = i-1;
        
        while((j >= 0) && (A[j] > v)){
            A[j+1] = A[j];
            j--;
            A[j+1] = v;
        }
        
        
        for(j=0;j<N;j++){
            printf("%d",A[i]);
            if(j != N-1) printf(" ");
            else printf("\n");
        }
    }
}

int main(){
    int N,i;
    int A[1000];
    
    scanf("%d",&N);
    
    for(i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    
    for(i=0;i<n;i++){
        printf("%d",A[i]);
        if(j != N-1) printf(" ");
        else printf("\n");
    }
    
    insertionSort(A,N);
    
}


Compiler output:
main.c: In function 'main':
main.c:36:15: error: 'n' undeclared (first use in this function)
   36 |     for(i=0;i<n;i++){
      |               ^
main.c:36:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:38:12: error: 'j' undeclared (first use in this function)
   38 |         if(j != N-1) printf(" ");
      |            ^
Language: C

#include<stdio.h>


void insertionSort(int A[],int N){
    int i,v,j;
    
    for(i=1;i<N;i++){
        v = A[i];
        j = i-1;
        
        while((j >= 0) && (A[j] > v)){
            A[j+1] = A[j];
            j--;
            A[j+1] = v;
        }
        
        
        for(j=0;j<N;j++){
            printf("%d",A[i]);
            if(j != N-1) printf(" ");
            else printf("\n");
        }
    }
}

int main(){
    int N,i;
    int A[1000];
    
    scanf("%d",&N);
    
    for(i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    
    for(i=0;i<N;i++){
        printf("%d",A[i]);
        if(j != N-1) printf(" ");
        else printf("\n");
    }
    
    insertionSort(A,N);
    
}


Compiler output:
main.c: In function 'main':
main.c:38:12: error: 'j' undeclared (first use in this function)
   38 |         if(j != N-1) printf(" ");
      |            ^
main.c:38:12: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

void insertionSort(int A[],int N){
    int i,j,v;
    
    for(i=1;i<N;i++){
        v=A[i];
        j=i-1;
        while(j>=0&&A[j]>v){
            A[j+1]=A[j];
            j--;
        }
        A[j+1]=v;
        for(i=0;i<N;i++){
            printf("%d",A[i]);
            if(i!=N-1) printf(" ");
            else putchar('\n');
        }
    }
}

int main(void){
    int N;
    scanf("%d",&N);
    
    int A[N];
    for(int i=0;i<N;i++) scanf("%d",&A[i]);
    for(i=0;i<N;i++){
        printf("%d",A[i]);
        if(i!=N-1) printf(" ");
        else putchar('\n');
    }
    insertionSort(A,N);
    
    return(0);
}


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

#include<stdio.h>

static const int N = 1000;

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

int main(){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

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

2   for(i=0;i<N-1;i++){
3     v = A[i]
4     j = i - 1
}
5     while(j>=0 &&A[j]>v){
6       A[j+1] = A[j]
7       j--
8     A[j+1] = v
}

trance(A,n);

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:23:2: error: expected ';' before 'for'
   23 | 2   for(i=0;i<N-1;i++){
      |  ^  ~~~
      |  ;
Language: C

#include<stdio.h>

static const int N = 1000;

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

int main(){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

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

2   for(i=0;i<N-1;i++){
3     v = A[i]
4     j = i - 1
5     while(j>=0 &&A[j]>v){
6       A[j+1] = A[j]
7       j--
8     A[j+1] = v
}
}

trance(A,n);

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:23:2: error: expected ';' before 'for'
   23 | 2   for(i=0;i<N-1;i++){
      |  ^  ~~~
      |  ;
Language: C

#include<stdio.h>

static const int N = 1000;

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

void swap(int *p_from, int *p_to){
    int tmp;
    tmp = *p_from;
    *p_from = *p_to;
    *p_to = tmp;
}

void sort(int A[], int n){
    int i,j;
    for(i=1;i<n;i++){
        j=i;
        while((j=0)&&(A[j-1]>a[j])){
            swap(&A[j-1],&A[j]);
            j--;
        }
    }
}

int main(){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
  
  trace(A, n);
  
  sort(A,n);
  
  tance(A,n);
  

  return 0;
}


Compiler output:
main.c: In function 'sort':
main.c:25:30: error: 'a' undeclared (first use in this function)
   25 |         while((j=0)&&(A[j-1]>a[j])){
      |                              ^
main.c:25:30: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:43:3: error: implicit declaration of function 'tance' [-Wimplicit-function-declaration]
   43 |   tance(A,n);
      |   ^~~~~
Language: C

#include<stdio.h>

static const int N = 1000;

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

void swap(int *p_from, int *p_to){
    int tmp;
    tmp = *p_from;
    *p_from = *p_to;
    *p_to = tmp;
}

void sort(int A[], int n){
    int i,j;
    for(i=1;i<n;i++){
        j=i;
        while((j=0)&&(A[j-1]>a[j])){
            swap(&A[j-1],&A[j]);
            j--;
        }
    }
}

int main(){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

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

  return 0;
}


Compiler output:
main.c: In function 'sort':
main.c:25:30: error: 'a' undeclared (first use in this function)
   25 |         while((j=0)&&(A[j-1]>a[j])){
      |                              ^
main.c:25:30: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

static const int N = 1000;

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

void swap(int *p_from, int *p_to){
    int tmp;
    tmp = *p_from;
    *p_from = *p_to;
    *p_to = tmp;
}

void sort(int A[], int n){
    int i,j;
    for(i=1;i<n;i++){
        j=i;
        while((j>0)&&(A[j-1]>a[j])){
            swap(&A[j-1],&A[j]);
            j--;
        }
    }
}

int main(){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

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

  return 0;
}


Compiler output:
main.c: In function 'sort':
main.c:25:30: error: 'a' undeclared (first use in this function)
   25 |         while((j>0)&&(A[j-1]>a[j])){
      |                              ^
main.c:25:30: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

static const int N = 1000;

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

void swap(int *p_from, int *p_to){
    int tmp;
    tmp = *p_from;
    *p_from = *p_to;
    *p_to = tmp;
}

void sort(int Ak, int n){
    int i,j;
    for(i=1;i<n;i++){
        j=i;
        while((j>0)&&(k[j-1]>a[j])){
            swap(&k[j-1],&k[j]);
            j--;
        }
    }
}

int main(){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

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

  return 0;
}


Compiler output:
main.c: In function 'sort':
main.c:25:23: error: 'k' undeclared (first use in this function)
   25 |         while((j>0)&&(k[j-1]>a[j])){
      |                       ^
main.c:25:23: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:30: error: 'a' undeclared (first use in this function)
   25 |         while((j>0)&&(k[j-1]>a[j])){
      |                              ^
main.c: In function 'main':
main.c:41:8: error: passing argument 1 of 'sort' makes integer from pointer without a cast [-Wint-conversion]
   41 |   sort(A,n);
      |        ^
      |        |
      |        int *
main.c:21:15: note: expected 'int' but argument is of type 'int *'
   21 | void sort(int Ak, int n){
      |           ~~~~^~
Language: C

#include<stdio.h>

static const int N = 1000;

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

void swap(int *p_from, int *p_to){
    int tmp;
    tmp = *p_from;
    *p_from = *p_to;
    *p_to = tmp;
}

void sort(int Ak, int n){
    int i,j;
    for(i=1;i<n;i++){
        j=i;
        while((j>0)&&(k[j-1]>a[j])){
            swap(&k[j-1],&k[j]);
            j--;
        }
    }
}

int main(void){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

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

  return 0;
}


Compiler output:
main.c: In function 'sort':
main.c:25:23: error: 'k' undeclared (first use in this function)
   25 |         while((j>0)&&(k[j-1]>a[j])){
      |                       ^
main.c:25:23: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:30: error: 'a' undeclared (first use in this function)
   25 |         while((j>0)&&(k[j-1]>a[j])){
      |                              ^
main.c: In function 'main':
main.c:41:8: error: passing argument 1 of 'sort' makes integer from pointer without a cast [-Wint-conversion]
   41 |   sort(A,n);
      |        ^
      |        |
      |        int *
main.c:21:15: note: expected 'int' but argument is of type 'int *'
   21 | void sort(int Ak, int n){
      |           ~~~~^~
Language: C

#include<stdio.h>

static const int N = 1000;

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

void swap(int *p_from, int *p_to){
    int tmp;
    tmp = *p_from;
    *p_from = *p_to;
    *p_to = tmp;
}

void sort(int Ak, int n){
    int i,j;
    for(i=1;i<n;i++){
        j=i;
        while((j>0)&&(k[j-1]>a[j])){
            swap(&k[j-1],&k[j]);
            j--;
        }
    }
}

int main(void){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

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

  return 0;
}


Compiler output:
main.c: In function 'sort':
main.c:25:23: error: 'k' undeclared (first use in this function)
   25 |         while((j>0)&&(k[j-1]>a[j])){
      |                       ^
main.c:25:23: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:30: error: 'a' undeclared (first use in this function)
   25 |         while((j>0)&&(k[j-1]>a[j])){
      |                              ^
main.c: In function 'main':
main.c:41:8: error: passing argument 1 of 'sort' makes integer from pointer without a cast [-Wint-conversion]
   41 |   sort(A,  n);
      |        ^
      |        |
      |        int *
main.c:21:15: note: expected 'int' but argument is of type 'int *'
   21 | void sort(int Ak, int n){
      |           ~~~~^~
Language: C

#include<stdio.h>

static const int N = 1000;

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

void swap(int *p_from, int *p_to){
    int tmp;
    tmp = *p_from;
    *p_from = *p_to;
    *p_to = tmp;
}

void sort(int Ak, int n){
    int i,j;
    for(i=1;i<n;i++){
        j=i;
        while((j>0)&&(k[j-1]>k[j])){
            swap(&k[j-1],&k[j]);
            j--;
        }
    }
}

int main(void){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

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

  return 0;
}


Compiler output:
main.c: In function 'sort':
main.c:25:23: error: 'k' undeclared (first use in this function)
   25 |         while((j>0)&&(k[j-1]>k[j])){
      |                       ^
main.c:25:23: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:41:8: error: passing argument 1 of 'sort' makes integer from pointer without a cast [-Wint-conversion]
   41 |   sort(A,  n);
      |        ^
      |        |
      |        int *
main.c:21:15: note: expected 'int' but argument is of type 'int *'
   21 | void sort(int Ak, int n){
      |           ~~~~^~
Language: C

#include<stdio.h>

static const int N = 1000;

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

void swap(int *p_from, int *p_to){
    int tmp;
    tmp = *p_from;
    *p_from = *p_to;
    *p_to = tmp;
}

void sort(int k, int n){
    int i,j;
    for(i=1;i<n;i++){
        j=i;
        while((j>0)&&(k[j-1]>k[j])){
            swap(&k[j-1],&k[j]);
            j--;
        }
    }
}

int main(void){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

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

  return 0;
}


Compiler output:
main.c: In function 'sort':
main.c:25:24: error: subscripted value is neither array nor pointer nor vector
   25 |         while((j>0)&&(k[j-1]>k[j])){
      |                        ^
main.c:25:31: error: subscripted value is neither array nor pointer nor vector
   25 |         while((j>0)&&(k[j-1]>k[j])){
      |                               ^
main.c:26:20: error: subscripted value is neither array nor pointer nor vector
   26 |             swap(&k[j-1],&k[j]);
      |                    ^
main.c:26:28: error: subscripted value is neither array nor pointer nor vector
   26 |             swap(&k[j-1],&k[j]);
      |                            ^
main.c: In function 'main':
main.c:41:8: error: passing argument 1 of 'sort' makes integer from pointer without a cast [-Wint-conversion]
   41 |   sort(A,  n);
      |        ^
      |        |
      |        int *
main.c:21:15: note: expected 'int' but argument is of type 'int *'
   21 | void sort(int k, int n){
      |           ~~~~^
Language: C

#include<stdio.h>

static const int N = 1000;

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

void swap(int *p_from, int *p_to){
    int tmp;
    tmp = *p_from;
    *p_from = *p_to;
    *p_to = tmp;
}

void sort(int k[], int n){
    int i,j;
    for(i=1;i<n;i++){
        j=i;
        while((j>0)&&(k[j-1]>k[j])){
            swap(&k[j-1],&k[j]);
            j--;
        }
    }
}

int main(void){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
  
  trace(A, n);
  
  sort(A, n);
  trance(A,n)

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:42:3: error: implicit declaration of function 'trance'; did you mean 'trace'? [-Wimplicit-function-declaration]
   42 |   trance(A,n)
      |   ^~~~~~
      |   trace
main.c:42:14: error: expected ';' before 'return'
   42 |   trance(A,n)
      |              ^
      |              ;
   43 | 
   44 |   return 0;
      |   ~~~~~~
Language: C

#include<stdio.h>
#define M 100

int N A[M];

void print(){
    int i;
    for(i=0;i<N;i++){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    
    printf("\n");
    
    void sort(){
        intj,i,val;
        for(i=1;i<N;i++){
            val = A[i]
            j=i-1;
            while(j>=0&&A[j]>val){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]=val;
            printf();
        }
    }
    
    int main(void){
        int i,j;
        scanf("%d",&N);
        for(i=0;i<N;i++){
            scanf("%d",&A[i]);
        }
        print();
        sort();
        return 0;
    }
}


Compiler output:
main.c:4:7: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'A'
    4 | int N A[M];
      |       ^
main.c: In function 'print':
main.c:8:15: error: 'N' undeclared (first use in this function)
    8 |     for(i=0;i<N;i++){
      |               ^
main.c:8:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:21: error: 'A' undeclared (first use in this function)
   10 |         printf("%d",A[i]);
      |                     ^
main.c: In function 'sort':
main.c:16:9: error: 'intj' undeclared (first use in this function); did you mean 'int'?
   16 |         intj,i,val;
      |         ^~~~
      |         int
main.c:16:16: error: 'val' undeclared (first use in this function)
   16 |         intj,i,val;
      |                ^~~
main.c:18:23: error: expected ';' before 'j'
   18 |             val = A[i]
      |                       ^
      |                       ;
   19 |             j=i-1;
      |             ~          
main.c:20:19: error: 'j' undeclared (first use in this function)
   20 |             while(j>=0&&A[j]>val){
      |                   ^
main.c:25:13: error: too few arguments to function 'printf'
   25 |             printf();
      |             ^~~~~~
In file included from main.c:1:
/usr/include/stdio.h:363:12: note: declared here
  363 | extern int printf (const char *__restrict __format, ...);
      |            ^~~~~~
Language: C

#include<stdio.h>
#define M 100

int N,A[M];

void print(){
    int i;
    for(i=0;i<N;i++){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    
    printf("\n");
    
    void sort(){
        intj,i,val;
        for(i=1;i<N;i++){
            val = A[i]
            j=i-1;
            while(j>=0&&A[j]>val){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]=val;
            printf();
        }
    }
    
    int main(void){
        int i,j;
        scanf("%d",&N);
        for(i=0;i<N;i++){
            scanf("%d",&A[i]);
        }
        print();
        sort();
        return 0;
    }
}


Compiler output:
main.c: In function 'sort':
main.c:16:9: error: 'intj' undeclared (first use in this function); did you mean 'int'?
   16 |         intj,i,val;
      |         ^~~~
      |         int
main.c:16:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:16: error: 'val' undeclared (first use in this function)
   16 |         intj,i,val;
      |                ^~~
main.c:18:23: error: expected ';' before 'j'
   18 |             val = A[i]
      |                       ^
      |                       ;
   19 |             j=i-1;
      |             ~          
main.c:20:19: error: 'j' undeclared (first use in this function)
   20 |             while(j>=0&&A[j]>val){
      |                   ^
main.c:25:13: error: too few arguments to function 'printf'
   25 |             printf();
      |             ^~~~~~
In file included from main.c:1:
/usr/include/stdio.h:363:12: note: declared here
  363 | extern int printf (const char *__restrict __format, ...);
      |            ^~~~~~
Language: C

#include<stdio.h>
#define M 100

int N,A[M];

void print(){
    int i;
    for(i=0;i<N;i++){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    
    printf("\n");
    
    void sort(){
        intj,i,val;
        for(i=1;i<N;i++){
            val = A[i];
            j=i-1;
            while(j>=0&&A[j]>val){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]=val;
            printf();
        }
    }
    
    int main(void){
        int i,j;
        scanf("%d",&N);
        for(i=0;i<N;i++){
            scanf("%d",&A[i]);
        }
        print();
        sort();
        return 0;
    }
}


Compiler output:
main.c: In function 'sort':
main.c:16:9: error: 'intj' undeclared (first use in this function); did you mean 'int'?
   16 |         intj,i,val;
      |         ^~~~
      |         int
main.c:16:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:16: error: 'val' undeclared (first use in this function)
   16 |         intj,i,val;
      |                ^~~
main.c:19:13: error: 'j' undeclared (first use in this function)
   19 |             j=i-1;
      |             ^
main.c:25:13: error: too few arguments to function 'printf'
   25 |             printf();
      |             ^~~~~~
In file included from main.c:1:
/usr/include/stdio.h:363:12: note: declared here
  363 | extern int printf (const char *__restrict __format, ...);
      |            ^~~~~~
Language: C

#include<stdio.h>
#define M 100

int N,A[M];

void print(){
    int i;
    for(i=0;i<N;i++){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    
    printf("\n");
    
    void sort(){
        int j,i,val;
        for(i=1;i<N;i++){
            val = A[i];
            j=i-1;
            while(j>=0&&A[j]>val){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]=val;
            printf();
        }
    }
    
    int main(void){
        int i,j;
        scanf("%d",&N);
        for(i=0;i<N;i++){
            scanf("%d",&A[i]);
        }
        print();
        sort();
        return 0;
    }
}


Compiler output:
main.c: In function 'sort':
main.c:25:13: error: too few arguments to function 'printf'
   25 |             printf();
      |             ^~~~~~
In file included from main.c:1:
/usr/include/stdio.h:363:12: note: declared here
  363 | extern int printf (const char *__restrict __format, ...);
      |            ^~~~~~
Language: C

#include<stdio.h>
#define M 100

int N,A[M];

void print(){
    int i;
    for(i=0;i<N;i++){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    
    printf("\n");
    
    void sort(){
        int j,i,val;
        for(i=1;i<N;i++){
            val = A[i];
            j=i-1;
            while(j>=0&&A[j]>val){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]=val;
            print();
        }
    }
    
    int main(void){
        int i,j;
        scanf("%d",&N);
        for(i=0;i<N;i++){
            scanf("%d",&A[i]);
        }
        print();
        sort();
        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>
#define M 100

int N,A[M];

void print(){
    int i;
    for(i=0;i<N;i++){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    
    printf("\n");
    
    void sort(){
        int j,i,val;
        for(i=1;i<N;i++){
            val = A[i];
            j=i-1;
            while(j>=0&&A[j]>val){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]=val;
            print();
        }
    }
    
    int main(){
        int i,j;
        scanf("%d",&N);
        for(i=0;i<N;i++){
            scanf("%d",&A[i]);
        }
        print();
        sort();
        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>
#define MAX 100

int N,A[MAX];

void print(){
    int i;
    for(i=0;i<N;i++){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    
    printf("\n");
    
    void sort(){
        int j,i,val;
        for(i=1;i<N;i++){
            val = A[i];
            j=i-1;
            while(j>=0&&A[j]>val){
                A[j+1]=A[j];
                j--;
            }
            A[j+1]=val;
            print();
        }
    }
    
    int main(){
        int i,j;
        scanf("%d",&N);
        for(i=0;i<N;i++){
            scanf("%d",&A[i]);
        }
        print();
        sort();
        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