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

#include <stdio.h>

int bubblesort(int A,int N)
{
  int i,j,v;
  int count = 0;
  for(i = 0; i < N - 1; i++)
  {
    for(j = N - 1; j > i - 1; j--)
    {
      if(*(A + j) < *(A + j - 1))
      {
        v = 0;
        v = *(A + j);
        *(A + j) = *(A + j - 1);
        *(A + j - 1) = v;
        count++;
      }
    }
  }
  return count;
}

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

Compiler output:
main.c: In function 'bubblesort':
main.c:11:10: error: invalid type argument of unary '*' (have 'int')
   11 |       if(*(A + j) < *(A + j - 1))
      |          ^~~~~~~~
main.c:11:21: error: invalid type argument of unary '*' (have 'int')
   11 |       if(*(A + j) < *(A + j - 1))
      |                     ^~~~~~~~~~~~
main.c:14:13: error: invalid type argument of unary '*' (have 'int')
   14 |         v = *(A + j);
      |             ^~~~~~~~
main.c:15:9: error: invalid type argument of unary '*' (have 'int')
   15 |         *(A + j) = *(A + j - 1);
      |         ^~~~~~~~
main.c:15:20: error: invalid type argument of unary '*' (have 'int')
   15 |         *(A + j) = *(A + j - 1);
      |                    ^~~~~~~~~~~~
main.c:16:9: error: invalid type argument of unary '*' (have 'int')
   16 |         *(A + j - 1) = v;
      |         ^~~~~~~~~~~~
main.c: In function 'main':
main.c:35:22: error: passing argument 1 of 'bubblesort' makes integer from pointer without a cast [-Wint-conversion]
   35 |   count = bubblesort(A,N);
      |                      ^
      |                      |
      |                      int *
main.c:3:20: note: expected 'int' but argument is of type 'int *'
    3 | int bubblesort(int A,int N)
      |                ~~~~^
Language: C

#include <stdio.h>

int bubblesort(int A,int N)
{
  int i,j,v;
  int count = 0;
  for(i = 0; i < N - 1; i++)
  {
    for(j = N - 1; j > i - 1; j--)
    {
      if(*(A + j) < *(A + j - 1))
      {
        v = 0;
        v = *(A + j);
        *(A + j) = *(A + j - 1);
        *(A + j - 1) = v;
        count++;
      }
    }
  }
  return count;
}

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

Compiler output:
main.c: In function 'bubblesort':
main.c:11:10: error: invalid type argument of unary '*' (have 'int')
   11 |       if(*(A + j) < *(A + j - 1))
      |          ^~~~~~~~
main.c:11:21: error: invalid type argument of unary '*' (have 'int')
   11 |       if(*(A + j) < *(A + j - 1))
      |                     ^~~~~~~~~~~~
main.c:14:13: error: invalid type argument of unary '*' (have 'int')
   14 |         v = *(A + j);
      |             ^~~~~~~~
main.c:15:9: error: invalid type argument of unary '*' (have 'int')
   15 |         *(A + j) = *(A + j - 1);
      |         ^~~~~~~~
main.c:15:20: error: invalid type argument of unary '*' (have 'int')
   15 |         *(A + j) = *(A + j - 1);
      |                    ^~~~~~~~~~~~
main.c:16:9: error: invalid type argument of unary '*' (have 'int')
   16 |         *(A + j - 1) = v;
      |         ^~~~~~~~~~~~
main.c: In function 'main':
main.c:35:22: error: passing argument 1 of 'bubblesort' makes integer from pointer without a cast [-Wint-conversion]
   35 |   count = bubblesort(A,N);
      |                      ^
      |                      |
      |                      int *
main.c:3:20: note: expected 'int' but argument is of type 'int *'
    3 | int bubblesort(int A,int N)
      |                ~~~~^
main.c:36:3: error: implicit declaration of function 'bublesort'; did you mean 'bubblesort'? [-Wimplicit-function-declaration]
   36 |   bublesort(A,N);
      |   ^~~~~~~~~
      |   bubblesort
Language: C

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

int bubblesort(int A,int N)
{
  int i,j,v;
  int count = 0;
  for(i = 0; i < N - 1; i++)
  {
    for(j = N - 1; j > i - 1; j--)
    {
      if(*(A + j) < *(A + j - 1))
      {
        v = 0;
        v = *(A + j);
        *(A + j) = *(A + j - 1);
        *(A + j - 1) = v;
        count++;
      }
    }
  }
  return count;
}

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

Compiler output:
main.c: In function 'bubblesort':
main.c:12:10: error: invalid type argument of unary '*' (have 'int')
   12 |       if(*(A + j) < *(A + j - 1))
      |          ^~~~~~~~
main.c:12:21: error: invalid type argument of unary '*' (have 'int')
   12 |       if(*(A + j) < *(A + j - 1))
      |                     ^~~~~~~~~~~~
main.c:15:13: error: invalid type argument of unary '*' (have 'int')
   15 |         v = *(A + j);
      |             ^~~~~~~~
main.c:16:9: error: invalid type argument of unary '*' (have 'int')
   16 |         *(A + j) = *(A + j - 1);
      |         ^~~~~~~~
main.c:16:20: error: invalid type argument of unary '*' (have 'int')
   16 |         *(A + j) = *(A + j - 1);
      |                    ^~~~~~~~~~~~
main.c:17:9: error: invalid type argument of unary '*' (have 'int')
   17 |         *(A + j - 1) = v;
      |         ^~~~~~~~~~~~
main.c: In function 'main':
main.c:36:22: error: passing argument 1 of 'bubblesort' makes integer from pointer without a cast [-Wint-conversion]
   36 |   count = bubblesort(A,N);
      |                      ^
      |                      |
      |                      int *
main.c:4:20: note: expected 'int' but argument is of type 'int *'
    4 | int bubblesort(int A,int N)
      |                ~~~~^
main.c:37:3: error: implicit declaration of function 'bublesort'; did you mean 'bubblesort'? [-Wimplicit-function-declaration]
   37 |   bublesort(A,N);
      |   ^~~~~~~~~
      |   bubblesort
Language: C

#include <stdio.h>

int bubblesort(int A,int N)
{
  int i,j,v;
  int count = 0;
  for(i = 0; i < N - 1; i++)
  {
    for(j = N - 1; j > i - 1; j--)
    {
      if(*(A + j) < *(A + j - 1))
      {
        v = 0;
      	v = *(A + j);
        *(A + j) = *(A + j - 1);
        *(A + j - 1) = v;
        count++;
      }
    }
  }
  return count;
}

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

Compiler output:
main.c: In function 'bubblesort':
main.c:11:10: error: invalid type argument of unary '*' (have 'int')
   11 |       if(*(A + j) < *(A + j - 1))
      |          ^~~~~~~~
main.c:11:21: error: invalid type argument of unary '*' (have 'int')
   11 |       if(*(A + j) < *(A + j - 1))
      |                     ^~~~~~~~~~~~
main.c:14:13: error: invalid type argument of unary '*' (have 'int')
   14 |         v = *(A + j);
      |             ^~~~~~~~
main.c:15:9: error: invalid type argument of unary '*' (have 'int')
   15 |         *(A + j) = *(A + j - 1);
      |         ^~~~~~~~
main.c:15:20: error: invalid type argument of unary '*' (have 'int')
   15 |         *(A + j) = *(A + j - 1);
      |                    ^~~~~~~~~~~~
main.c:16:9: error: invalid type argument of unary '*' (have 'int')
   16 |         *(A + j - 1) = v;
      |         ^~~~~~~~~~~~
main.c: In function 'main':
main.c:35:22: error: passing argument 1 of 'bubblesort' makes integer from pointer without a cast [-Wint-conversion]
   35 |   count = bubblesort(A,N);
      |                      ^
      |                      |
      |                      int *
main.c:3:20: note: expected 'int' but argument is of type 'int *'
    3 | int bubblesort(int A,int N)
      |                ~~~~^
Language: C

#include<stdio.h>
int main(void){
	int A[100];
	int N,i,v;
	int cunt=0;
	int cunt2=0;;
	
	
	scanf("%d",&N);
	for(i=0;i<N;i++)scanf("%d",&A[i]);
	
	while(1){
		for(i=N;i>0;i--){
			if(A[i-1]>A[i]){
				v=A[i-1];
				A[i-1]=A[i];
				A[i]=v;
				cunt++;
			}
		}
		if(cunt2==cunt){
			break;
		}else cunt2=cunt;
	}
	
	for(i=0;i<N;i++){
		if(i>0)printf(" ");
		printf("%d",A[i]);
	}
	printf(" %d\",cunt);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:30:16: warning: missing terminating " character
   30 |         printf(" %d\",cunt);
      |                ^
main.c:30:16: error: missing terminating " character
   30 |         printf(" %d\",cunt);
      |                ^~~~~~~~~~~~~
main.c:31:9: error: expected expression before 'return'
   31 |         return 0;
      |         ^~~~~~
main.c:31:18: error: expected ';' before '}' token
   31 |         return 0;
      |                  ^
      |                  ;
   32 | }
      | ~
Language: C

#inclide<stdio.h>
int main(void)
{
  int i, j, temp;
scanf("5d)

  for (i = 0; i < (array_size - 1); i++) {
    for (j = (array_size - 1); j > i; j--) {
      if (numbers[j-1] > numbers[j]) {
        temp = numbers[j-1];
        numbers[j-1] = numbers[j];
        numbers[j] = temp;
printf("%d" ,temp);
}
    }
  }
return 0;

}

Compiler output:
main.c:1:2: error: invalid preprocessing directive #inclide; did you mean #include?
    1 | #inclide<stdio.h>
      |  ^~~~~~~
      |  include
main.c: In function 'main':
main.c:5:1: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    5 | scanf("5d)
      | ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #inclide<stdio.h>
main.c:5:1: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    5 | scanf("5d)
      | ^~~~~
main.c:5:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:5:7: warning: missing terminating " character
    5 | scanf("5d)
      |       ^
main.c:5:7: error: missing terminating " character
    5 | scanf("5d)
      |       ^~~~
main.c:7:3: error: expected expression before 'for'
    7 |   for (i = 0; i < (array_size - 1); i++) {
      |   ^~~
main.c:17:10: error: expected ';' before '}' token
   17 | return 0;
      |          ^
      |          ;
   18 | 
   19 | }
      | ~
Language: C

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

Compiler output:
main.c: In function 'main':
main.c:11:13: error: 'j' undeclared (first use in this function)
   11 |         for(j=0;j<N;j++){
      |             ^
main.c:11:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:25:16: warning: missing terminating " character
   25 |         printf(" %d\",cunt);
      |                ^
main.c:25:16: error: missing terminating " character
   25 |         printf(" %d\",cunt);
      |                ^~~~~~~~~~~~~
main.c:26:9: error: expected expression before 'return'
   26 |         return 0;
      |         ^~~~~~
main.c:26:18: error: expected ';' before '}' token
   26 |         return 0;
      |                  ^
      |                  ;
   27 | }
      | ~
Language: C

#include <stdio.h>
int main(void){
	int a[100];
	int N,i,j,swap,awi = 0;,flag = 1;
	
	scanf("%d", &N);
	
	for(i=0; i<N; i++){
		scanf("%d",a[i]);
	}
	
	i = 0;
	
	while(flag){
		flag = 0;
		
		for(j=N-1; j > i+1; j--){
			if( a[j] < a[j-1] ){
				swap = a[j];
				a[j] = a[j-1];
				a[j-1] = swap;
				awi++;
			}
			flag = 1;
		}
		i++;
	}
			
	for(i=0; i<N; i++){
		printf(" %d",a[i]);
	}
	
	printf("%d",awi);
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:4:32: error: expected expression before ',' token
    4 |         int N,i,j,swap,awi = 0;,flag = 1;
      |                                ^
main.c:4:33: error: 'flag' undeclared (first use in this function)
    4 |         int N,i,j,swap,awi = 0;,flag = 1;
      |                                 ^~~~
main.c:4:33: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int main()
{
 int a[1000],n,i,j,d=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+1;j--)
        if A[j] < A[j-1]
        {
          swap A[j] and A[j-1]
          d++;
        }
 for(i=0;i<n;i++)
 {
  printf("%d",a[i]);
 }
 printf("%d\n",d);
}

Compiler output:
main.c: In function 'main':
main.c:8:20: error: expected ';' before 'for'
    8 |   scanf("%d",&a[i])
      |                    ^
      |                    ;
    9 |  for (i = 0,i<n;i++)
      |  ~~~
Language: C

#include <stdio.h>

int main()
{
 int a[1000],n,i,j,d=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+1;j--)
     {
        if A[j] < A[j-1]
        {
          swap A[j] and A[j-1]
          d++;
        }
     }
}
 for(i=0;i<n;i++)
 {
  printf("%d",a[i]);
 }
 printf("%d\n",d);
}

Compiler output:
main.c: In function 'main':
main.c:8:20: error: expected ';' before 'for'
    8 |   scanf("%d",&a[i])
      |                    ^
      |                    ;
    9 |  for (i = 0,i<n;i++)
      |  ~~~
Language: C

#include <stdio.h>

int main()
{
 int a[1000],n,i,j,d=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+1;j--)
     {
        if A[j] < A[j-1]
        {
          swap A[j] and A[j-1]
          d++;
        }
     }
 }
 for(i=0;i<n;i++)
 {
  printf("%d",a[i]);
 }
 printf("%d\n",d);
}

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

#include <stdio.h>

void hoanvi(int x,int y)
{
 int temp=x;
 x=y;
 y=temp;
}
int main()
{
 int a[1000],n,i,j,d=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+1;j--)
     {
        if (a[j] < a[j-1])
        {
          hoanvi(a[j],a[j-1]);
          d++;
        }
     }
 }
 for(i=0;i<n;i++)
 {
  printf("%d",a[i]);
 }
 printf("%d\n",d);
}

Compiler output:
main.c: In function 'main':
main.c:15:20: error: expected ';' before ')' token
   15 |  for (i = 0,i<n;i++)
      |                    ^
      |                    ;
Language: C

#include <stdio.h>

void hoanvi(int & x,int & y)
{
 int temp=x;
 x=y;
 y=temp;
}
int main()
{
 int a[1000],n,i,j,d=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+1;j--)
     {
        if (a[j] < a[j-1])
        {
          hoanvi(a[j-1],a[j]);
          d++;
        }
     }
 }
 for(i=0;i<n;i++)
 {
  printf("%d",a[i]);
 }
 printf("%d\n",d);
 return 0;
}

Compiler output:
main.c:3:17: error: expected ';', ',' or ')' before '&' token
    3 | void hoanvi(int & x,int & y)
      |                 ^
main.c: In function 'main':
main.c:21:11: error: implicit declaration of function 'hoanvi' [-Wimplicit-function-declaration]
   21 |           hoanvi(a[j-1],a[j]);
      |           ^~~~~~
Language: C

#include <stdio.h>

void hoanvi(int &x,int &y)
{
 int temp=x;
 x=y;
 y=temp;
}

int main()
{
 int a[1000],n,i,j,d=0;
 scanf("%d",&n);

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

 for (i = 0;i<n-1;i++)
 {   
     for (j = n-1;j>= i+1;j--)
     {
        if (a[j] < a[j-1])
        {
          hoanvi(a[j-1],a[j]);
          d++;
        }
     }
 }

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

Compiler output:
main.c:3:17: error: expected ';', ',' or ')' before '&' token
    3 | void hoanvi(int &x,int &y)
      |                 ^
main.c: In function 'main':
main.c:25:11: error: implicit declaration of function 'hoanvi' [-Wimplicit-function-declaration]
   25 |           hoanvi(a[j-1],a[j]);
      |           ^~~~~~
Language: C

#include<stdio.h>


int A[];
int main( void ) 
{
  
    int n;
    int count=0;
    scanf( "%d", &n );
     
    int i, j;

    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-1] > A[j])
			{
				int temp = A[j-1];
				A[j-1] = A[j];
				A[j]=temp;
				count++;
			}
		}
    }
    printf("%d",A[0]);
    for(i=1;i<N;i++) printf(" %d",A[i]);
    printf("\n");
    printf("%d\n",cnt);
	
}

Compiler output:
main.c: In function 'main':
main.c:32:15: error: 'N' undeclared (first use in this function)
   32 |     for(i=1;i<N;i++) printf(" %d",A[i]);
      |               ^
main.c:32:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:34:19: error: 'cnt' undeclared (first use in this function); did you mean 'int'?
   34 |     printf("%d\n",cnt);
      |                   ^~~
      |                   int
main.c: At top level:
main.c:4:5: warning: array 'A' assumed to have one element
    4 | int A[];
      |     ^
Language: C

#include<stdio.h>

int main(void)
{
int N,i,n,j,a;
n=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++)
{
for(j=N-1;j>i;j--)
{
if(array[j]<array[j-1]){
a=array[j-1];
array[j-1]=array[j];
array[j]=a;
n++;
}
}
for(i=0;i<N-1;i++) printf("%d ",array[i]);
printf("%d\n%d\n",array[N-1],n);

Compiler output:
main.c: In function 'main':
main.c:22:1: error: expected declaration or statement at end of input
   22 | printf("%d\n%d\n",array[N-1],n);
      | ^~~~~~
main.c:22:1: error: expected declaration or statement at end of input
Language: C

#include<stdio.h>
 
int main(void)
{
int N,i,n,j,a;
n=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++)
{
for(j=N-1;j>i;j--)
{
if(array[j]<array[j-1]){
a=array[j-1];
array[j-1]=array[j];
array[j]=a;
n++;
}
}
for(i=0;i<N-1;i++) printf("%d ",array[i]);
printf("%d\n%d\n",array[N-1],n);
return 0;
}

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

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

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

#include<stdio.h>

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

Compiler output:
main.c: In function 'main':
main.c:10:9: error: 'j' undeclared (first use in this function)
   10 |    for (j = i; j >= 0);j--){
      |         ^
main.c:10:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:22: error: expected ';' before ')' token
   10 |    for (j = i; j >= 0);j--){
      |                      ^
      |                      ;
main.c:10:27: error: expected ';' before ')' token
   10 |    for (j = i; j >= 0);j--){
      |                           ^
      |                           ;
main.c:10:27: error: expected statement before ')' token
Language: C

#include<stdio.h>

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

Compiler output:
main.c: In function 'main':
main.c:10:22: error: expected ';' before ')' token
   10 |    for (j = i; j >= 0);j--){
      |                      ^
      |                      ;
main.c:10:27: error: expected ';' before ')' token
   10 |    for (j = i; j >= 0);j--){
      |                           ^
      |                           ;
main.c:10:27: error: expected statement before ')' token
Language: C

#include <iostream>
using namespace std;
//使用flag的冒泡排序法
int bubbleSort(int A[],int N){
    int sw=0;
    bool flag=1;
    for(int i=0;flag;i++){
        flag=0;
        for(int j=N-1;j>=i+1;j--){
            if(A[j]<A[j-1]){
                //交?相?元素
                swap(A[j],A[j-1]);
                flag=1;
                sw++; 
            }
        }
    }
    return sw;
} 
int main(){
    int A[100],N,sw;
    cin>>N;
    for(int i=0;i<N;i++)cin>>A[i];
    sw=bubbleSort(A,N);
    for(int i=0;i<N;i++){
        if(i)cout<<" ";
        cout<<A[i];
    }
    cout<<endl;
    cout<<sw<<endl;
    return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
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];
    bool done = 1;
    scanf("%d", &n);

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

    trace(A, n);
    for(i = 0; i < size; i++)
    {
        for(j = 0; j < size - 1 - i; j++)
        {
            if (list[j] > list[j + 1])
            {
                list[j] = list[j + 1] ^ list[j];
                list[j + 1] = list[j + 1] ^ list[j];
                list[j] = list[j + 1] ^ list[j];
                done = 0;
            }
        }
        if(done == 1)
            break;
    }

    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:5: error: unknown type name 'bool'
   17 |     bool done = 1;
      |     ^~~~
main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:23:20: error: 'size' undeclared (first use in this function); did you mean 'size_t'?
   23 |     for(i = 0; i < size; i++)
      |                    ^~~~
      |                    size_t
main.c:23:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:27:17: error: 'list' undeclared (first use in this function)
   27 |             if (list[j] > list[j + 1])
      |                 ^~~~
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, done;
    int A[N+1];
    scanf("%d", &n);

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

    trace(A, n);
    done = 1;
    for(i = 0; i < size; i++)
    {
        for(j = 0; j < size - 1 - i; j++)
        {
            if (list[j] > list[j + 1])
            {
                list[j] = list[j + 1] ^ list[j];
                list[j + 1] = list[j + 1] ^ list[j];
                list[j] = list[j + 1] ^ list[j];
                done = 0;
            }
        }
        if(done == 1)
            break;
    }

    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:20: error: 'size' undeclared (first use in this function); did you mean 'size_t'?
   23 |     for(i = 0; i < size; i++)
      |                    ^~~~
      |                    size_t
main.c:23:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:27:17: error: 'list' undeclared (first use in this function)
   27 |             if (list[j] > list[j + 1])
      |                 ^~~~
Language: C

// bubblesort.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//

#include "stdio.h"


int main()
{
    int N, a, A[1000],j,x,count;
    scanf("%d", &N);

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

    int flag = 1;
    int i = 0;
    while (flag) {
       flag = 0;
        for (j = N - 1;  j > i; j--) {
            if (A[j] < A[j - 1]) {
                x = A[j];
                A[j] = A[j - 1];
                A[j - 1] = x;
                flag = 1;
                count++
            }
         
        }
        i++;
    }
   
    for (j = 0; j < N - 1; j++)
        printf("%d ", A[j]);

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

Compiler output:
main.c: In function 'main':
main.c:25:24: error: expected ';' before '}' token
   25 |                 count++
      |                        ^
      |                        ;
   26 |             }
      |             ~
Language: C

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

??return 0;
}

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

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

??return 0;
}

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

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

??return 0;
}

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

#include "stdio.h"
??
??int main()
{
    int n, a[100], j, x, count, i;
    scanf("%d", &n);

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

    for (i = 0; i<n; i++) {
        for (j = n - 1; j > 0; j--)
            if (a[j] < a[j - 1]) {
                x = a[j];
                a[j] = a[j - 1];
                a[j - 1] = x;
                count++;
            }

    }

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

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

    return 0;
}

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

#include<stdio.h>

int main(){

   int i,j,n,count = 0;

   scanf("%d",&n);

   int a[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]){

    int tmp = a[j};

    a[j] = a[j-1];

    a[j-1] = tmp;

     count++;

   }

 }

}

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

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

    printf("%d\n%d\n".a[n-1],count);

  return 0;

 }

Compiler output:
main.c: In function 'main':
main.c:21:18: error: expected ']' before '}' token
   21 |     int tmp = a[j};
      |                  ^
      |                  ]
main.c:21:18: error: expected ',' or ';' before '}' token
main.c:39:22: error: request for member 'a' in something not a structure or union
   39 |     printf("%d\n%d\n".a[n-1],count);
      |                      ^
Language: C

#include<stdio.h>

int main(){

   int i,j,n,count = 0;

   scanf("%d",&n);

   int a[n] = 100;

  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]){

    int tmp = a[j];

    a[j] = a[j-1];

    a[j-1] = tmp;

     count++;

   }

 }

}

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

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

    printf("%d\n%d\n",a[n-1],count);

  return 0;

 }

Compiler output:
main.c: In function 'main':
main.c:9:15: error: variable-sized object may not be initialized except with an empty initializer
    9 |    int a[n] = 100;
      |               ^~~
Language: C

#include<stdio.h>
#define n 100

int main(){

   int i,j,n,count = 0;

   scanf("%d",&n);

   int a[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]){

    int tmp = a[j];

    a[j] = a[j-1];

    a[j-1] = tmp;

     count++;

   }

 }

}

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

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

    printf("%d\n%d\n",a[n-1],count);

  return 0;

 }

Compiler output:
main.c: In function 'main':
main.c:2:11: error: expected identifier or '(' before numeric constant
    2 | #define n 100
      |           ^~~
main.c:6:12: note: in expansion of macro 'n'
    6 |    int i,j,n,count = 0;
      |            ^
main.c:8:15: error: lvalue required as unary '&' operand
    8 |    scanf("%d",&n);
      |               ^
main.c:28:6: error: 'count' undeclared (first use in this function)
   28 |      count++;
      |      ^~~~~
main.c:28:6: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

void bubbleSort(int A[], int N){
  int i, j, k, count = 0;
  for( i = 0; i < N; i++ ){
    for(j = i + 1 ; j < N; j++ ){
      if(A[i] > A[j]){
        k = A[j];
        A[j] = A[i];
        A[i] = k;
        count += 1;
      }
    }
  }
  space(A, N);
  printf("%d\n",count);
}

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

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

Compiler output:
main.c: In function 'bubbleSort':
main.c:15:3: error: implicit declaration of function 'space' [-Wimplicit-function-declaration]
   15 |   space(A, N);
      |   ^~~~~
main.c: At top level:
main.c:19:6: warning: conflicting types for 'space'; have 'void(int *, int)'
   19 | void space(int A[], int N){
      |      ^~~~~
main.c:15:3: note: previous implicit declaration of 'space' with type 'void(int *, int)'
   15 |   space(A, N);
      |   ^~~~~
main.c: In function 'main':
main.c:38:16: error: expected expression before ']' token
   38 |   bubbleSort(A[], N);
      |                ^
Language: C

#include<stdio.h>

int main()
{
   int N, i, j, temp, count=0;
   int A[100];

   scanf("%d", &N);

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

   for(i=0; i<N-1; i++){   \*N-1?????°???????????¨????????????????????§??????*\
      for(j=N-1; j>=i+1; j--){
         if(A[j]<A[j-1]){
            temp = A[j];
            A[j] = A[j-1];
            A[j-1] = temp;
         }
      }
   }

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

   printf("%d", count);

   return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:28: error: stray '\' in program
   13 |    for(i=0; i<N-1; i++){   \*N-1?????°???????????¨????????????????????§??????*\
      |                            ^
main.c:13:29: error: invalid type argument of unary '*' (have 'int')
   13 |    for(i=0; i<N-1; i++){   \*N-1?????°???????????¨????????????????????§??????*\
      |                             ^~
main.c:13:34: error: expected expression before '?' token
   13 |    for(i=0; i<N-1; i++){   \*N-1?????°???????????¨????????????????????§??????*\
      |                                  ^
main.c:13:38: error: stray '\302' in program
   13 |    for(i=0; i<N-1; i++){   \*N-1?????<U+00B0>???????????<U+00A8>????????????????????<U+00A7>??????*\
      |                                      ^~~~~~~~
main.c:13:50: error: '\U000000a8' undeclared (first use in this function)
   13 |    for(i=0; i<N-1; i++){   \*N-1?????°???????????¨????????????????????§??????*\
      |                                                  ^
main.c:13:50: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:71: error: stray '\302' in program
   13 |    for(i=0; i<N-1; i++){   \*N-1?????<U+00B0>???????????<U+00A8>????????????????????<U+00A7>??????*\
      |                                                                                     ^~~~~~~~
Language: C

#include<stdio.h>
int main()
{
   int n, v;
   int A[150];
   int i = 0,
       j = 0,
	   s = 0;
   
   scanf("%d", &n);
   while (i < n) {
      scanf("%d", &A[i]);
      i++;
   }

   for (i = n - 1; i >= 0; --i) {
      for (j = i; j >= 0; --j) {
         if (A[i] < A[j]) {
            v = A[i];
			A[i] = A[j];
			A[j] = v;
			s = s + 1;
		 }
      }
   }
   for (i = 0; i < n; ++i) {
      printf("%d", A[i]);
	  if (k != n - 1)
		  putchar(' ');
   }
   putchar('\n');
   printf("%d\n", s);
   return 0;
}

Compiler output:
main.c: In function 'main':
main.c:28:15: error: 'k' undeclared (first use in this function)
   28 |           if (k != n - 1)
      |               ^
main.c:28:15: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
 
void syuturyoku( int A[], int N )
{
   int i;
   for ( i = 0; i < N; i++ ) {
      if ( i > 0 ) {
         printf(" ");
      }
      printf("%d", A[i]);
   }
   printf("\n");
}
 
void bubbleSort( int A[], int N )
{
   int i, j, v;
   int wa = 0;

   for ( i = 0; i < N; i++ ) {
      j = N - 1 - i;
      if ( j >= 0 && A[ j ] < A[ j - 1 ] ) {
         v = A[ j ];
         A[ j ] = A[ j - 1 ];
         A[ j - 1 ] = v;

      }
      wa = wa + 1;
   }


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

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

#include <stdio.h>
 
void syuturyoku( int A[], int N )
{
   int i;
   for ( i = 0; i < N; i++ ) {
      if ( i > 0 ) {
         printf(" ");
      }
      printf("%d", A[i]);
   }
   printf("\n");
}
 
void bubbleSort( int A[], int N )
{
   int i, j, v;
   int wa = 0;

   for ( i = 0; i < N; i++ ) {
      j = N - 1 - i;
      if ( j >= 0 && A[ j ] < A[ j - 1 ] ) {
         v = A[ j ];
         A[ j ] = A[ j - 1 ];
         A[ j - 1 ] = v;

      }
      wa = wa + 1;
   }


int main()
{
   int N, i, j;
   int A[100];
 
   scanf("%d", &N);
   for ( i = 0; i < N; i++ ) {
      scanf("%d", &A[i]);
   }
   printf("%d\n", wa);
   syuturyoku( A, N );
   bubbleSort( A, N );
 
   return 0;
}

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

#include <stdio.h>
 
void syuturyoku( int A[], int N )
{
   int i;
   for ( i = 0; i < N; i++ ) {
      if ( i > 0 ) {
         printf(" ");
      }
      printf("%d", A[i]);
   }
   printf("\n");
}
 
void bubbleSort( int A[], int N )
{
   int i, j, v;
   int wa = 0;

   for ( i = 0; i < N; i++ ) {
      j = N - 1 - i;
      if ( j >= 0 && A[ j ] < A[ j - 1 ] ) {
         v = A[ j ];
         A[ j ] = A[ j - 1 ];
         A[ j - 1 ] = v;

      }
      wa = wa + 1;
   }


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

   syuturyoku( A, N );
   bubbleSort( A, N );
   printf("%d", wa);
 
   return 0;
}

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

#include <stdio.h>
 
void syuturyoku( int A[], int N )
{
   int i;
   for ( i = 0; i < N; i++ ) {
      if ( i > 0 ) {
         printf(" ");
      }
      printf("%d", A[i]);
   }
   printf("\n");
}
 
void bubbleSort( int A[], int N )
{
   int i, j, v;
   int wa = 0;

   for ( i = 0; i < N; i++ ) {
      j = N - 1 - i;
      if ( j >= 0 && A[ j ] < A[ j - 1 ] ) {
         v = A[ j ];
         A[ j ] = A[ j - 1 ];
         A[ j - 1 ] = v;

      }
      wa = wa + 1;
   }


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

   syuturyoku( A, N );
   bubbleSort( A, N );
   printf("%d", wa);
 
   return 0;
}

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

#include<stdio.h>

int main () {

   int n, i, flag, swap;
   int a[100] = {0};
   int count = 0;

   scanf("%d", &n);

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

   flag = 1;

   while(flag){
      flag = 0;

      for(i = n-1; i > 0; i--){
         if(a[i] < a[j-1]){
            a[j] = swap;
            a[j] = a[j-1];
            a[j-1] = swap;
            flag = 1;
            count++;
         }
      }
   }

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

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

   return 0;

}

     

Compiler output:
main.c: In function 'main':
main.c:21:22: error: 'j' undeclared (first use in this function)
   21 |          if(a[i] < a[j-1]){
      |                      ^
main.c:21:22: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int main(){

   int i,j,n;
   int count = 0;
   int a[100] = 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]){

    int tmp = a[j];

    a[j] = a[j-1];

    a[j-1] = tmp;

     count++;

   }

}

}

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

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

}

    printf("%d\n%d\n",a[n-1],count);

  return 0;

 }

Compiler output:
main.c: In function 'main':
main.c:7:17: error: invalid initializer
    7 |    int a[100] = 0;
      |                 ^
Language: C

#include <stdio.h>
  
void bubbleSort( int A[], int N )
{
   int i, j, v;
   int wa = 0;

   for ( i = 0; i < N; i++ ) {
      j = N - 1 - i;
      for ( k = j; k = 0; k-- ) {
         if ( k >= 0 && A[ k ] < A[ k - 1 ] ) {
            v = A[ k ];
            A[ k ] = A[ k - 1 ];
            A[ k - 1 ] = v;
         }
      }
      wa = wa + 1;
   }
}

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

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

   bubbleSort( A, N );
   syuturyoku( A, N );
   printf("%d\n", wa);
 
   return 0;
}

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

#include <stdio.h>

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

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

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

  return 0; 
}

int bubbleSort(int A[], int n)  {
  int i, j, sw = 0, flag = 1, temp;
  for ( i = 0; i < flag; i++)  {
    flag = 0;
    for (j = n-1; j >= i+1; j--)  {
      if (A[j] < A[j-1])  {
        temp = A[j];
        A[j] = A[j-1];
        A[j-1] = temp; 
        flag = 1;
        sw++;
      }
    }
  return sw;
  }
}

}
    

Compiler output:
main.c: In function 'main':
main.c:6:16: error: 'n' undeclared (first use in this function)
    6 |   scanf("%d", &n);
      |                ^
main.c:6:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:11:3: error: 'sw' undeclared (first use in this function)
   11 |   sw = bubbleSort(A, n);
      |   ^~
main.c:11:8: error: implicit declaration of function 'bubbleSort' [-Wimplicit-function-declaration]
   11 |   sw = bubbleSort(A, n);
      |        ^~~~~~~~~~
main.c: At top level:
main.c:41:1: error: expected identifier or '(' before '}' token
   41 | }
      | ^
Language: C

#include<stdio.h>

int bubbleSort(intA[], int N){
  int i, j, temp;
  int sw = 0;
  
  for (i=0; flag = 1; i++) {
    flag = 0;
    for (j=N-1; j>i+1; j--) {
      if (A[j-1] > A[j]) {
        temp   = A[j-1];
        A[j-1] = A[j];
        A[j]   = temp;
        sw++;
        flag = 1;
      }
    }
  }
  return sw;
}


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

  sw = bubbleSort(A, N);

  for (i=0; i<N; i++) {
    printf("%d", A[i]);
    if (i<N-1)
      putchar(' ');
  }
  printf("%d", sw);
  return 0;
}

Compiler output:
main.c:3:16: error: unknown type name 'intA'; did you mean 'int'?
    3 | int bubbleSort(intA[], int N){
      |                ^~~~
      |                int
main.c: In function 'main':
main.c:29:8: error: implicit declaration of function 'bubbleSort' [-Wimplicit-function-declaration]
   29 |   sw = bubbleSort(A, N);
      |        ^~~~~~~~~~
Language: C

#include<stdio.h>

int bubbleSort(intA[], int N){
  int i, j, temp;
  int sw = 0;
  int flag = 1;

  for (i=0; flag = 1; i++) {
    flag = 0;
    for (j=N-1; j>i+1; j--) {
      if (A[j-1] > A[j]) {
        temp   = A[j-1];
        A[j-1] = A[j];
        A[j]   = temp;
        sw++;
        flag = 1;
      }
    }
  }
  return sw;
}


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

  sw = bubbleSort(A, N);

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

Compiler output:
main.c:3:16: error: unknown type name 'intA'; did you mean 'int'?
    3 | int bubbleSort(intA[], int N){
      |                ^~~~
      |                int
main.c: In function 'main':
main.c:30:8: error: implicit declaration of function 'bubbleSort' [-Wimplicit-function-declaration]
   30 |   sw = bubbleSort(A, N);
      |        ^~~~~~~~~~
Language: C

#include <stdio.h>
void trace(int a[],int N){
  int i;
  for(i=0;i<N;i++){
    if(i>0){
      printf(" ");
    }
      printf("%d",a[i])}
  }
  printf("\n");
}

void bubblesort(int a,int N){
  int i,j,v,s;
  s=0;
  for(i=1;i<N;i++){
    v=a[i];
    j=i-1;
    for(j=N-1;j>=i;j--){ 
      if(a[j]<v){
      a[j-1]=a[j];
      j--;
      s++;
      }
    a[j+1]=v;
    }
  }
  trace(a,N);
}
  
int main(void)
{
  int i,j,N,a[100];
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&a[i]);
  }
  bubblesort(a,N);
  printf("%d\n",s);
  return 0;
}
  

Compiler output:
main.c: In function 'trace':
main.c:8:24: error: expected ';' before '}' token
    8 |       printf("%d",a[i])}
      |                        ^
      |                        ;
main.c: At top level:
main.c:10:10: error: expected declaration specifiers or '...' before string constant
   10 |   printf("\n");
      |          ^~~~
main.c:11:1: error: expected identifier or '(' before '}' token
   11 | }
      | ^
main.c: In function 'bubblesort':
main.c:17:8: error: subscripted value is neither array nor pointer nor vector
   17 |     v=a[i];
      |        ^
main.c:20:11: error: subscripted value is neither array nor pointer nor vector
   20 |       if(a[j]<v){
      |           ^
main.c:21:8: error: subscripted value is neither array nor pointer nor vector
   21 |       a[j-1]=a[j];
      |        ^
main.c:21:15: error: subscripted value is neither array nor pointer nor vector
   21 |       a[j-1]=a[j];
      |               ^
main.c:25:6: error: subscripted value is neither array nor pointer nor vector
   25 |     a[j+1]=v;
      |      ^
main.c:28:9: error: passing argument 1 of 'trace' makes pointer from integer without a cast [-Wint-conversion]
   28 |   trace(a,N);
      |         ^
      |         |
      |         int
main.c:2:16: note: expected 'int *' but argument is of type 'int'
    2 | void trace(int a[],int N){
      |            ~~~~^~~
main.c: In function 'main':
main.c:38:14: error: passing argument 1 of 'bubblesort' makes integer from pointer without a cast [-Wint-conversion]
   38 |   bubblesort(a,N);
      |              ^
      |              |
      |              int *
main.c:13:21: note: expected 'int' but argument is of type 'int *'
   13 | void bubblesort(int a,int N){
      |                 ~~~~^
main.c:39:17: error: 's' undeclared (first use in this function)
   39 |   printf("%d\n",s);
      |                 ^
main.c:39:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int bubbleSort(intA[], int N){
  int i, j, temp;
  int sw = 0;
  int flag = 1;

  for (i=0; flag = 1; i++) {
    flag = 0;
    for (j=N-1; j>i+1; j--) {
      if (A[j-1] > A[j]) {
        temp   = A[j-1];
        A[j-1] = A[j];
        A[j]   = temp;
        sw++;
        flag = 1;
      }
    }
  }
  return sw;
}


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

  sw = bubbleSort(A, N);

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

Compiler output:
main.c:3:16: error: unknown type name 'intA'; did you mean 'int'?
    3 | int bubbleSort(intA[], int N){
      |                ^~~~
      |                int
main.c: In function 'main':
main.c:30:8: error: implicit declaration of function 'bubbleSort' [-Wimplicit-function-declaration]
   30 |   sw = bubbleSort(A, N);
      |        ^~~~~~~~~~