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

#include<stdio.h>

int main(void){
	int X,Y, N;
	int A[1000];
	int i=0;
	//while((scanf("%d",&X))!='\n'){
	//	N=X; //????´???°
	//}
	scanf("%d",&N);
	while((scanf("%d",&Y))!=EOF){
		A[i] = Y;
		i++;
	}
	
	int flag=1;
	int change=0; //???????????°
	while(fla-1g){
		flag=0;
		for(int j=N-1; i>=1; j--){
			if(A[j]<A[j-1]){
				int stock = A[j];
				A[j] = A[j-1];
				A[j-1] = stock;
				flag=1; 
				change++;
			}
		}
	}
	for(i=0; i<N; i++){
		printf("%d ",A[i]);
	}
	printf("\n");
	printf("%d",change);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:18:15: error: 'fla' undeclared (first use in this function); did you mean 'flag'?
   18 |         while(fla-1g){
      |               ^~~
      |               flag
main.c:18:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:18:19: error: invalid suffix "g" on integer constant
   18 |         while(fla-1g){
      |                   ^~
Language: C

#include <stdio.h>
int i,j;
int count=0;


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


void BubbleSort(int A[ ], int n){
	int j,temp;
		for(i = 0; i < N-1; i++){
			for(j = N-1; j > i; j--)
			if(A[j-1] > A[j]){
				temp = A[j-1];
				A[j-1] = A[j];
				A[j] = temp;
				count++;
			}		
	}
}


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

	printf("%d\n",count);
	
	return 0;
}

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

#include <cstdio>

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


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


void bubbleSort(){
    int i = 0,j,flag = 1,tmp;
    while(flag == 1){
        flag = 0;
        for(j=n-1;j>i;j--){
            if(a[j-1]>a[j]){
                count++;
                tmp = a[j];
                a[j] = a[j-1];
                a[j-1] = tmp;
                flag = 1;
            }
        }
        i++;
    }
}


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

Compiler output:
main.c:1:10: fatal error: cstdio: No such file or directory
    1 | #include <cstdio>
      |          ^~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>

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

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

#include<stdio.h>

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

Compiler output:
main.c: In function 'main':
main.c:6:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    6 |         int i.j;
      |              ^
main.c:6:14: error: expected expression before '.' token
main.c:11:13: error: 'i' undeclared (first use in this function)
   11 |         for(i=0;i<n;i++){
      |             ^
main.c:11:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:21: error: 'j' undeclared (first use in this function)
   15 |                 for(j = 0;j < n-1-i;j++){
      |                     ^
Language: C

#import <stdio.h>



int main() {
    int N;
    scanf("%d", &N);

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

    int reversed_flag;
    int swap_count = 0;

    // sort
    do {
        reversed_flag = 0;

        for (int i = N - 1; i < 2; i--) {
            if (V[i] < if V[i - 1]) {
                int temp_element = V[i];
                V[i] = V[i - 1];
                V[i - 1] = temp_element;

                reversed_flag = 1;
                swap_count++;
            }
        }
    } while (reversed_flag);

    // output answer
    for (int i = 0; i < N; i++) {
        printf("%d", V[i]);
        if (i < N - 1) { printf(" "); }
    }

    printf("%d", swap_count);
    return 0;
}



Compiler output:
main.c:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
    1 | #import <stdio.h>
      |  ^~~~~~
main.c: In function 'main':
main.c:22:24: error: expected expression before 'if'
   22 |             if (V[i] < if V[i - 1]) {
      |                        ^~
Language: C

#include <stdio.h>

void print(int array[], int size) {
	for(int i = 0; i < size-1; i++) {
		printf("%d ", array[i]);
	}
	printf("%d\n", array[size-1]);

	return;
}

void swap(int &a, int &b) {
	int &tmp = a;
	a = b;
	b = tmp;	
}

void bubble_sort(int array[], int size) {
	for(int i = size-1; i > 0; i--) {
		for(int j = i-1; j >= 0; j--) {
			if(array[i] < array[j]) {
				swap(&array[i], &array[j]);
			}
		}
		print(array, size);
	}
}
int main() {
	int N;
	int A[100];
	scanf("%d", &N);
	for(int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}

	print(A, N);
	bubble_sort(A, N);

	return 0;
}




Compiler output:
main.c:12:15: error: expected ';', ',' or ')' before '&' token
   12 | void swap(int &a, int &b) {
      |               ^
main.c: In function 'bubble_sort':
main.c:22:33: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   22 |                                 swap(&array[i], &array[j]);
      |                                 ^~~~
Language: C

#include <stdio.h>
using namespace std;

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 flag = 1;
	int j, v, count=0;
	while(flag){
		flag = 0;
		for(j=N-1; j >=1; j--){
			if (A[j] < A[j-1]){
				v = A[j];
				A[j] = A[j-1];
				A[j-1] = v;
				flag = 1;
				count++;
			}
		}
	}
	trace(A, N);
	printf("%d", count);
}

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

	return 0;
}


Compiler output:
main.c:2:1: error: unknown type name 'using'
    2 | using namespace std;
      | ^~~~~
main.c:2:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
    2 | using namespace std;
      |                 ^~~
Language: C

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


Compiler output:
main.c: In function 'main':
main.c:34:5: error: expected declaration or statement at end of input
   34 |     return 0;
      |     ^~~~~~
Language: C

#include<stdio.h>

void show(int A[],int N){
  for (int i = 0; i < N; i++) {
    printf("%d",A[i] );
    if(i!=N-1)printf(" " );
  }
}

int  bubble (int A[],int N){
  int i ,j;
  int c;
  j=N;
  int sw;
  
  for (i= j-1; 0<j; i--) {
    if(A[i]<A[i-1]){
      sw=A[i-1];
      A[i-1]=A[i];
      A[i]=sw;
      c++;
    }
  }
  show(A[],N);
  return c;
}

int main(){
  int A[100];
  int N;
scanf("%d\n",&N);

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


Compiler output:
main.c: In function 'bubble':
main.c:24:10: error: expected expression before ']' token
   24 |   show(A[],N);
      |          ^
Language: C

#include <stdio.h>

void bubblesort(int A[],int N,int count){
  int i ,j;
  int tmp,count;
  count = 0
  for(i = N; i <1; i-- ){
    for(j = N; j < N-i+1; j--){
      if(A[j] > A[j-1]){
        tmp = A[j];
        A[j] = A[j-1];
        A[j-1] = tmp;
      }
      count++
    }
  }
}

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

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

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

  bubblesort(A,N,count)

  trace(A,N,count)

}


Compiler output:
main.c: In function 'bubblesort':
main.c:5:11: error: 'count' redeclared as different kind of symbol
    5 |   int tmp,count;
      |           ^~~~~
main.c:3:35: note: previous definition of 'count' with type 'int'
    3 | void bubblesort(int A[],int N,int count){
      |                               ~~~~^~~~~
main.c:6:12: error: expected ';' before 'for'
    6 |   count = 0
      |            ^
      |            ;
    7 |   for(i = N; i <1; i-- ){
      |   ~~~       
main.c: In function 'main':
main.c:36:24: error: expected ';' before 'trace'
   36 |   bubblesort(A,N,count)
      |                        ^
      |                        ;
   37 | 
   38 |   trace(A,N,count)
      |   ~~~~~
Language: C

#include <stdio.h>

void bubblesort(int A[],int N,int count){
  int i ,j;
  int tmp,count;
  count = 0
  for(i = N; i <1; i-- ){
    for(j = N; j < N-i+1; j--){
      if(A[j] > A[j-1]){
        tmp = A[j];
        A[j] = A[j-1];
        A[j-1] = tmp;
      }
      count++
    }
  }
}

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

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

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

  bubblesort(A,N,count);

  trace(A,N,count);

}


Compiler output:
main.c: In function 'bubblesort':
main.c:5:11: error: 'count' redeclared as different kind of symbol
    5 |   int tmp,count;
      |           ^~~~~
main.c:3:35: note: previous definition of 'count' with type 'int'
    3 | void bubblesort(int A[],int N,int count){
      |                               ~~~~^~~~~
main.c:6:12: error: expected ';' before 'for'
    6 |   count = 0
      |            ^
      |            ;
    7 |   for(i = N; i <1; i-- ){
      |   ~~~
Language: C

#include <stdio.h>

void bubblesort(int A[],int N,int count){
  int i ,j;
  int tmp;
  count = 0
  for(i = N; i <1; i-- ){
    for(j = N; j < N-i+1; j--){
      if(A[j] > A[j-1]){
        tmp = A[j];
        A[j] = A[j-1];
        A[j-1] = tmp;
      }
      count++
    }
  }
}

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

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

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

  bubblesort(A,N,count);

  trace(A,N,count);

}


Compiler output:
main.c: In function 'bubblesort':
main.c:6:12: error: expected ';' before 'for'
    6 |   count = 0
      |            ^
      |            ;
    7 |   for(i = N; i <1; i-- ){
      |   ~~~
Language: C

#include <stdio.h>

void bubblesort(int A[],int N,int count){
  int i ,j;
  int tmp;
  count = 0
  for(i = N; i <1; i-- ){
    for(j = N; j < N-i+1; j--){
      if(A[j] > A[j-1]){
        tmp = A[j];
        A[j] = A[j-1];
        A[j-1] = tmp;
      }
      count++;
    }
  }
}

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

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

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

  bubblesort(A,N,count);

  trace(A,N,count);

}


Compiler output:
main.c: In function 'bubblesort':
main.c:6:12: error: expected ';' before 'for'
    6 |   count = 0
      |            ^
      |            ;
    7 |   for(i = N; i <1; i-- ){
      |   ~~~
Language: C

#include<iostream>
using namespace std;
int A[100],N,sw;
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()
{
 
    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:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

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


Compiler output:
main.c: In function 'main':
main.c:10:33: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   10 |                                 swap(&a[j],&a[j-1]);
      |                                 ^~~~
Language: C

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


int kuuhaku(char str[], char tok[][20][20],int seisu[], int n)
{
	char *p = str;
	int i = 0;
	strtok(p, " ");
	strcpy(tok[i], p);

	while (1) {
		i++;
		p = strtok(NULL, " ");
		if (p == NULL)
			break;
		strcpy(tok[0][i], p);
	}

	for (i = 0; i < n; i++) {
		seisu[i] = atoi(tok[0][i]);
	}

	return 0;

}

int swap(int seisu[],int cou, int n)
{
	int irekae;
	int i, j;

	for (i = 0; i < n; i++) {
		for (j = n - 1; 0 < j; j--) {
			if (seisu[j] < seisu[j - 1]) {
				irekae = seisu[j];
				seisu[j] = seisu[j - 1];
				seisu[j - 1] = irekae;
				cou++;
			}
		}
	}
	return cou;
	
}



int main(void)
{
	int i = 0, j = 0, n, count = 0;
	int seisu[250];
	char str[250];
	char tok[250];
	scanf("%d", &n);
while{}
	fgets(str, sizeof(str), stdin);


	kuuhaku(str, &tok, seisu, n);

	

	count = swap(seisu, count, n);


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

	putchar('\n');

	printf("%d", count);

	return 0;

}


Compiler output:
main.c: In function 'kuuhaku':
main.c:12:19: error: passing argument 1 of 'strcpy' from incompatible pointer type [-Wincompatible-pointer-types]
   12 |         strcpy(tok[i], p);
      |                   ^
      |                   |
      |                   char (*)[20]
In file included from main.c:4:
/usr/include/string.h:141:39: note: expected 'char * restrict' but argument is of type 'char (*)[20]'
  141 | extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
      |                      ~~~~~~~~~~~~~~~~~^~~~~~
main.c: In function 'main':
main.c:58:6: error: expected '(' before '{' token
   58 | while{}
      |      ^
      |      (
main.c:62:22: error: passing argument 2 of 'kuuhaku' from incompatible pointer type [-Wincompatible-pointer-types]
   62 |         kuuhaku(str, &tok, seisu, n);
      |                      ^~~~
      |                      |
      |                      char (*)[250]
main.c:7:30: note: expected 'char (*)[20][20]' but argument is of type 'char (*)[250]'
    7 | int kuuhaku(char str[], char tok[][20][20],int seisu[], int n)
      |                         ~~~~~^~~~~~~~~~~~~
Language: C

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


int kuuhaku(char str[], char tok[][20][20],int seisu[], int n)
{
	char *p = str;
	int i = 0;
	strtok(p, " ");
	strcpy(tok[i], p);

	while (1) {
		i++;
		p = strtok(NULL, " ");
		if (p == NULL)
			break;
		strcpy(tok[0][i], p);
	}

	for (i = 0; i < n; i++) {
		seisu[i] = atoi(tok[0][i]);
	}

	return 0;

}

int swap1(int seisu[],int cou, int n)
{
	int irekae;
	int i, j;

	for (i = 0; i < n; i++) {
		for (j = n - 1; 0 < j; j--) {
			if (seisu[j] < seisu[j - 1]) {
				irekae = seisu[j];
				seisu[j] = seisu[j - 1];
				seisu[j - 1] = irekae;
				cou++;
			}
		}
	}
	return cou;
	
}



int main(void)
{
	int i = 0, j = 0, n = 0, count = 0;
	int seisu[250];
	char str[250];
	char tok[250];

	
	scanf("%d", &n);
	while (getchar() != '\n');

	fgets(str, sizeof(str), stdin);


	kuuhaku(str, &tok, seisu, n);

	

	count = swap1(seisu, count, n);


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

	putchar('\n');

	printf("%d", count);

	return 0;

}


Compiler output:
main.c:1:1: error: stray '##' in program
    1 | ##define _CRT_SECURE_NO_WARNINGS
      | ^~
main.c:1:3: error: unknown type name 'define'
    1 | ##define _CRT_SECURE_NO_WARNINGS
      |   ^~~~~~
main.c:1:33: error: expected ';' before 'typedef'
    1 | ##define _CRT_SECURE_NO_WARNINGS
      |                                 ^
      |                                 ;
main.c: In function 'kuuhaku':
main.c:12:19: error: passing argument 1 of 'strcpy' from incompatible pointer type [-Wincompatible-pointer-types]
   12 |         strcpy(tok[i], p);
      |                   ^
      |                   |
      |                   char (*)[20]
In file included from main.c:4:
/usr/include/string.h:141:39: note: expected 'char * restrict' but argument is of type 'char (*)[20]'
  141 | extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
      |                      ~~~~~~~~~~~~~~~~~^~~~~~
main.c: In function 'main':
main.c:65:22: error: passing argument 2 of 'kuuhaku' from incompatible pointer type [-Wincompatible-pointer-types]
   65 |         kuuhaku(str, &tok, seisu, n);
      |                      ^~~~
      |                      |
      |                      char (*)[250]
main.c:7:30: note: expected 'char (*)[20][20]' but argument is of type 'char (*)[250]'
    7 | int kuuhaku(char str[], char tok[][20][20],int seisu[], int n)
      |                         ~~~~~^~~~~~~~~~~~~
Language: C


int main(void)
{
	int i = 0, j = 0, n = 0, count = 0;
	int seisu[250];
	char str[250];
	char tok[250];

	
	scanf("%d", &n);
	while (getchar() != '\n');

	fgets(str, sizeof(str), stdin);


	kuuhaku(str, &tok, seisu, n);

	

	count = swap1(seisu, count, n);


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

	putchar('\n');

	printf("%d", count);

	return 0;

}


Compiler output:
main.c: In function 'main':
main.c:10:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   10 |         scanf("%d", &n);
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | 
main.c:10:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   10 |         scanf("%d", &n);
      |         ^~~~~
main.c:10:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:11:16: error: implicit declaration of function 'getchar' [-Wimplicit-function-declaration]
   11 |         while (getchar() != '\n');
      |                ^~~~~~~
main.c:11:16: note: 'getchar' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c:13:9: error: implicit declaration of function 'fgets' [-Wimplicit-function-declaration]
   13 |         fgets(str, sizeof(str), stdin);
      |         ^~~~~
main.c:13:33: error: 'stdin' undeclared (first use in this function)
   13 |         fgets(str, sizeof(str), stdin);
      |                                 ^~~~~
main.c:13:33: note: 'stdin' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c:13:33: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:9: error: implicit declaration of function 'kuuhaku' [-Wimplicit-function-declaration]
   16 |         kuuhaku(str, &tok, seisu, n);
      |         ^~~~~~~
main.c:20:17: error: implicit declaration of function 'swap1' [-Wimplicit-function-declaration]
   20 |         count = swap1(seisu, count, n);
      |                 ^~~~~
main.c:24:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   24 |                 printf("%d ", seisu[i]);
      |                 ^~~~~~
main.c:24:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:24:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:24:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:27:9: error: implicit declaration of function 'putchar' [-Wimplicit-function-declaration]
   27 |         putchar('\n');
      |         ^~~~~~~
main.c:27:9: note: include '<stdio.h>' or provide a declaration of 'putchar'
main.c:29:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   29 |         printf("%d", count);
      |         ^~~~~~
main.c:29:9: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include <iostream>
#define maxn 150
using namespace std;
int s[maxn];
int main()
{
    int N,t,ans=0,cas=0;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>s[i];
    }
    for(int i=0;i<=N-1;i++){
        for(int j=N-1;j>=i+1;j--){
            if(s[j]<s[j-1]){
                t=s[j];
                s[j]=s[j-1];
                s[j-1]=t;
                ans++;
            }
        }
    }
    for(int i=0;i<N;i++){
        if(++cas>1) cout<<" ";
        cout<<s[i];
    }
    cout<<endl;
    cout<<ans;
    return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C


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

bubbleSort(A, N)
{
 int j, flag;
 flag = 1;
 while flag{
  flag = 0;
  for (j=N-1; j--; 1<=j) {
 	if A[j] < A[j-1] {
		A[j] = A[j-1];
		flag = 1;
		}
	}
 }
}

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);
 bubbleSort(A, N);

 return 0;
}


Compiler output:
main.c: In function 'trace':
main.c:5:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    5 |   printf("%d", A[i]);
      |   ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | 
main.c:5:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
    5 |   printf("%d", A[i]);
      |   ^~~~~~
main.c:5:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:7:2: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
    7 |  printf("\n");
      |  ^~~~~~
main.c:7:2: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:10:1: error: return type defaults to 'int' [-Wimplicit-int]
   10 | bubbleSort(A, N)
      | ^~~~~~~~~~
main.c: In function 'bubbleSort':
main.c:10:1: error: type of 'A' defaults to 'int' [-Wimplicit-int]
main.c:10:1: error: type of 'N' defaults to 'int' [-Wimplicit-int]
main.c:14:8: error: expected '(' before 'flag'
   14 |  while flag{
      |        ^~~~
      |        (
main.c: In function 'main':
main.c:29:2: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   29 |  scanf("%d", &N);
      |  ^~~~~
main.c:29:2: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:29:2: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:29:2: note: include '<stdio.h>' or provide a declaration of 'scanf'
Language: C


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

bubbleSort(A, N)
{
 int j, flag;
 flag = 1;
 while {
  flag = 0;
  for (j=N-1; j--; 1<=j) {
 	if A[j] < A[j-1] {
		A[j] = A[j-1];
		flag = 1;
		}
	}
 }
}

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);
 bubbleSort(A, N);

 return 0;
}


Compiler output:
main.c: In function 'trace':
main.c:5:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    5 |   printf("%d", A[i]);
      |   ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | 
main.c:5:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
    5 |   printf("%d", A[i]);
      |   ^~~~~~
main.c:5:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:7:2: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
    7 |  printf("\n");
      |  ^~~~~~
main.c:7:2: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:10:1: error: return type defaults to 'int' [-Wimplicit-int]
   10 | bubbleSort(A, N)
      | ^~~~~~~~~~
main.c: In function 'bubbleSort':
main.c:10:1: error: type of 'A' defaults to 'int' [-Wimplicit-int]
main.c:10:1: error: type of 'N' defaults to 'int' [-Wimplicit-int]
main.c:14:8: error: expected '(' before '{' token
   14 |  while {
      |        ^
      |        (
main.c:17:12: error: expected '(' before 'A'
   17 |         if A[j] < A[j-1] {
      |            ^
      |            (
main.c:17:13: error: subscripted value is neither array nor pointer nor vector
   17 |         if A[j] < A[j-1] {
      |             ^
main.c: In function 'main':
main.c:29:2: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   29 |  scanf("%d", &N);
      |  ^~~~~
main.c:29:2: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:29:2: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:29:2: note: include '<stdio.h>' or provide a declaration of 'scanf'
Language: C


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

bubbleSort(A, N)
{
 int j, flag;
 flag = 1;
 while(flag) {
  flag = 0;
  for (j=N-1; j--; 1<=j) {
 	if (A[j] < A[j-1]) {
		A[j] = A[j-1];
		flag = 1;
		}
	}
 }
}

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);
 bubbleSort(A, N);

 return 0;
}


Compiler output:
main.c: In function 'trace':
main.c:5:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    5 |   printf("%d", A[i]);
      |   ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | 
main.c:5:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
    5 |   printf("%d", A[i]);
      |   ^~~~~~
main.c:5:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:7:2: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
    7 |  printf("\n");
      |  ^~~~~~
main.c:7:2: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:10:1: error: return type defaults to 'int' [-Wimplicit-int]
   10 | bubbleSort(A, N)
      | ^~~~~~~~~~
main.c: In function 'bubbleSort':
main.c:10:1: error: type of 'A' defaults to 'int' [-Wimplicit-int]
main.c:10:1: error: type of 'N' defaults to 'int' [-Wimplicit-int]
main.c:17:14: error: subscripted value is neither array nor pointer nor vector
   17 |         if (A[j] < A[j-1]) {
      |              ^
main.c:17:21: error: subscripted value is neither array nor pointer nor vector
   17 |         if (A[j] < A[j-1]) {
      |                     ^
main.c:18:18: error: subscripted value is neither array nor pointer nor vector
   18 |                 A[j] = A[j-1];
      |                  ^
main.c:18:25: error: subscripted value is neither array nor pointer nor vector
   18 |                 A[j] = A[j-1];
      |                         ^
main.c: In function 'main':
main.c:29:2: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   29 |  scanf("%d", &N);
      |  ^~~~~
main.c:29:2: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:29:2: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:29:2: note: include '<stdio.h>' or provide a declaration of 'scanf'
Language: C

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


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

#include<iostream>
using namespace std;

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;i>=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:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include <stdio.h>

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


Compiler output:
main.c: In function 'main':
main.c:10:11: error: 'flag' undeclared (first use in this function)
   10 |     while(flag=0){
      |           ^~~~
main.c:10:11: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:13: error: 'j' undeclared (first use in this function)
   12 |         for(j=0;j>n-1;j--){
      |             ^
main.c:14:17: error: 'x' undeclared (first use in this function)
   14 |                 x=A[i];
      |                 ^
main.c:15:17: error: 'y' undeclared (first use in this function)
   15 |                 y=A[i-1];
      |                 ^
Language: C

#include <stdio.h>

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


Compiler output:
main.c: In function 'main':
main.c:14:17: error: 'x' undeclared (first use in this function)
   14 |                 x=A[i];
      |                 ^
main.c:14:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:17: error: 'y' undeclared (first use in this function)
   15 |                 y=A[i-1];
      |                 ^
Language: C

#include <stdio.h>

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


Compiler output:
main.c: In function 'main':
main.c:25:21: error: expected ';' before 'return'
   25 |     printf("%d\n",j)
      |                     ^
      |                     ;
   26 |     return 0;
      |     ~~~~~~
Language: C

#include<stdio.h>

int main(){
   int i,j,x,A[100],N,count =0,flag = 1 // 逆の隣接要素が存在する
   
   scanf("%d",&N);
   
   for(i = 0 ; i < N ; i++){
       scanf("%d",&A[i]);
   }
   
   while(flag){
     flag = 0
     for (j=N-1 ; j < 1 ; j++){
       if(A[j] < A[j-1]){
           x = A[j];
           A[j] = A[j-1];
           A[j-1] = x;
         flag = 1;
         count++;
       }
     }
   }
    for(i = 0 ; i < N ; i++){
       printf("%d",A[i]);
   }
   printf("\n%d\n",count);
}


Compiler output:
main.c: In function 'main':
main.c:6:4: error: expected ',' or ';' before 'scanf'
    6 |    scanf("%d",&N);
      |    ^~~~~
main.c:13:14: error: expected ';' before 'for'
   13 |      flag = 0
      |              ^
      |              ;
   14 |      for (j=N-1 ; j < 1 ; j++){
      |      ~~~
Language: C

/* 
 * File:   main.c
 * Author: s1252007
 *
 * Created on June 19, 2018, 10:55 AM
 */

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

/*
 * 
 */

int bubbleSort(
    int *a,
    int n
);

int main(int argc, char** argv) {
    int size, counter;
    int *A;
    
    scanf("%d", &size);
    A = (int *)malloc(sizeof(int) * size);
    for (int ix = 0; ix < size; ++ix)
    {
        scanf("%d", &A[ix]);
        if (ix > 0) printf(" ");
        printf("%d", A[ix]);
    }
    printf("\n");
    counter = bubbleSort(A, size);
    printf("%d\n", counter);
    return (EXIT_SUCCESS);
}

int bubbleArray( int *a, int n )
{
    int counter;
    for( int i = 1; i < n; i++ )
    {
            for( int j = n-1; j>=i; j-- )
            {
                    if( a[ j ] < a[ j-1 ] )
                    {
                            int copy;

                            copy = a[ j ];
                            a[ j ] = a[ j-1 ];
                            a[ j-1 ] = copy;
                            counter++;
                    }
            }
    }
    return counter;
}




Compiler output:
/usr/bin/ld: /tmp/cc7is8Me.o: in function `main':
main.c:(.text+0xd2): undefined reference to `bubbleSort'
collect2: error: ld returned 1 exit status
Language: C

/* 
 * File:   main.c
 * Author: s1252007
 *
 * Created on June 19, 2018, 10:55 AM
 */

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

/*
 * 
 */

int bubbleSort(
    int *a,
    int n
);

int main(int argc, char** argv) {
    int size, counter;
    int *A;
    
    scanf("%d", &size);
    A = (int *)malloc(sizeof(int) * size);
    for (int ix = 0; ix < size; ++ix)
    {
        scanf("%d", &A[ix]);
        if (ix > 0) printf(" ");
        printf("%d", A[ix]);
    }
    printf("\n");
    counter = bubbleSort(A, size);
    printf("%d\n", counter);
    return (EXIT_SUCCESS);
}

int bubbleArray( int *a, int n )
{
    int counter;
    for( int i = 1; i < n; i++ )
    {
            for( int j = n-1; j>=i; j-- )
            {
                    if( a[ j ] < a[ j-1 ] )
                    {
                            int copy;

                            copy = a[ j ];
                            a[ j ] = a[ j-1 ];
                            a[ j-1 ] = copy;
                            counter++;
                    }
            }
    }
    return counter;
}




Compiler output:
/usr/bin/ld: /tmp/ccO291Fw.o: in function `main':
main.c:(.text+0xd2): undefined reference to `bubbleSort'
collect2: error: ld returned 1 exit status
Language: C

#include<stdio.h>

int main(){
   int i,j,x,A[100],N,count =0,flag = 1; // 逆の隣接要素が存在する
   
   scanf("%d",&N);
   
   for(i = 0 ; i < N ; i++){
       scanf("%d",&A[i]);
   }
   
   while(flag){
     flag = 0
     for (j=N-1 ; j < 1 ; j++){
       if(A[j] < A[j-1]){
           x = A[j];
           A[j] = A[j-1];
           A[j-1] = x;
         flag = 1;
         count++;
       }
     }
   }
    for(i = 0 ; i < N ; i++){
       printf("%d",A[i]);
   }
   printf("\n%d\n",count);
}


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

#include <stdio.h>

int main(){
    int i,j,k=0,n,flag=1;
    
    scanf("%d",&n);
    int A[n];
    for(i=0;i<n;i++){
        scanf("%d",&A[i]);
    }
    while(flag=0){
        flag=0;
        for(i=n-1;i>1;i--){
            if(A[i]<A[i-1]){
                x=A[i];
                y=A[i-1];
                A[i]=y;
                A[i-1]=x;
                flag=1;
            }
        }
    }
}


Compiler output:
main.c: In function 'main':
main.c:15:17: error: 'x' undeclared (first use in this function)
   15 |                 x=A[i];
      |                 ^
main.c:15:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:17: error: 'y' undeclared (first use in this function)
   16 |                 y=A[i-1];
      |                 ^
Language: C

#include <stdio.h>

int main(){
    int i,j,k=0,n,flag=1;
    
    scanf("%d",&n);
    int A[n];
    for(i=0;i<n;i++){
        scanf("%d",&A[i]);
    }
    while(flag=0){
        flag=0;
        k++;
        for(i=n-1;i>1;i--){
            if(A[i]<A[i-1]){
                x=A[i];
                y=A[i-1];
                A[i]=y;
                A[i-1]=x;
                flag=1;
            }
        }
    }
    for(i=0;i<n;i++){
        printf("%d",A[i]);
    }
    printf("%d",k);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:16:17: error: 'x' undeclared (first use in this function)
   16 |                 x=A[i];
      |                 ^
main.c:16:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:17: error: 'y' undeclared (first use in this function)
   17 |                 y=A[i-1];
      |                 ^
Language: C

#include <stdio.h>

int main(){
    int i,j,k=0,n,flag=1;
    
    scanf("%d",&n);
    int A[n];
    for(i=0;i<n;i++){
        scanf("%d",&A[i]);
    }
    while(flag==0){
        flag=0;
        k++;
        for(i=n-1;i>1;i--){
            if(A[i]<A[i-1]){
                x=A[i];
                y=A[i-1];
                A[i]=y;
                A[i-1]=x;
                flag=1;
            }
        }
    }
    for(i=0;i<n;i++){
        printf("%d",A[i]);
    }
    printf("%d",k);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:16:17: error: 'x' undeclared (first use in this function)
   16 |                 x=A[i];
      |                 ^
main.c:16:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:17: error: 'y' undeclared (first use in this function)
   17 |                 y=A[i-1];
      |                 ^
Language: C

#include"stdio.h"
#include"stdlib.h"
int main()
{
    int i,j;
    int n;
    int *A;
    int buf;
    int count=0;
    scanf("%d",&n);
    A=(int*)malloc(sizeof(int)*n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&Aa[i]);   
    }
    for(i=0;i<n;i++)
    {
        for(j=n-1;j>i;j--)
        {
            if(A[j-1]>A[j])
            {
                buf=A[j-1];
                A[j]=buf;
                count++;
            }
        }
    }
    printf("%d",A[0]);
    for(i=1;i<n;i++)
    {
        printf(" %d",A[i]);
    }
    printf("\n%d\n",count);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:14:21: error: 'Aa' undeclared (first use in this function); did you mean 'A'?
   14 |         scanf("%d",&Aa[i]);
      |                     ^~
      |                     A
main.c:14:21: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int main(){
    int i,j,k=0,n,flag=1,x,y;
    
    scanf("%d",&n);
    int A[n];
    for(i=0;i<n;i++){
        scanf("%d",&A[i]);
    }
    while(flag!=0){
        flag=0;
        for(i=n-1;i>=1;i--){
            if(A[i]<A[i-1]){
                x=A[i];
                y=A[i-1];
                A[i]=y;
                A[i-1]=x;
                flag=1;
                k++;
            }
        }
    }
    for(i=0;i<n;i++){
        if(i==n-1) print("%d",A[i]);
        else printf("%d ",A[i]);
    }
    printf("\n%d\n",k);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:25:20: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   25 |         if(i==n-1) print("%d",A[i]);
      |                    ^~~~~
      |                    printf
Language: C

#include <stdio.h>

int x[100];

int main(){
  int i;
  int n;
  int cnt = 0;
  int flag;
  int tempo;

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

    flag = 1;
    while(flag){
      flag = 0;
      for(j=n-1;j>0;j--){
        if(x[j] < x[j-1]){
          tempo = x[j];
          x[j] = x[j-1];
          x[j-1] = tempo;
          cnt++;
          flag = 1;
        }
      }
          for(i=0;i<n;i++){
            printf("%d",a[i]);
            if(i<n-1){
              printf(" ");
            }
          }
        }
          printf("\n%d\n",cnt);
        return 0;
      }


Compiler output:
main.c: In function 'main':
main.c:20:11: error: 'j' undeclared (first use in this function)
   20 |       for(j=n-1;j>0;j--){
      |           ^
main.c:20:11: note: each undeclared identifier is reported only once for each function it appears in
main.c:30:25: error: 'a' undeclared (first use in this function)
   30 |             printf("%d",a[i]);
      |                         ^
Language: C

#include <stdio.h>

int main(){

  int n,i,j,flag,t,c=0;
  
  scanf("%d",&n);

  int A[n];

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

   while(flag){

    flag=0;
    
    for(j=n-1;j>0;j--){
      
      if(A[j]<A[j-1]){
	t=A[j-1];
	A[j-1]=A[j];
	A[j]=t;
	c++;
	flag=1;
	
	}
      }
}

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



Compiler output:
main.c: In function 'main':
main.c:33:26: error: stray '\' in program
   33 |     if(i==n-1)printf("%d"\n,A[i]);
      |                          ^
main.c:33:26: error: expected ')' before 'n'
   33 |     if(i==n-1)printf("%d"\n,A[i]);
      |                     ~    ^~
      |                          )
main.c:37:16: warning: unknown escape sequence: '\d'
   37 |   printf("\d\n",c);
      |                ^
Language: C

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



Compiler output:
main.c: In function 'main':
main.c:31:25: error: expected ';' before 'return'
   31 |   printf("%d\n",count*3)
      |                         ^
      |                         ;
   32 |   return 0;
      |   ~~~~~~
Language: C

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



Compiler output:
main.c: In function 'main':
main.c:31:23: error: expected ';' before 'return'
   31 |   printf("%d\n",count)
      |                       ^
      |                       ;
   32 |   return 0;
      |   ~~~~~~
Language: C

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

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

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

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



Compiler output:
main.c: In function 'main':
main.c:26:22: error: expected ')' before 'A'
   26 |     else printf("%d "A[i]);
      |                ~     ^
      |                      )
Language: C

#include<stdio.h>
#define SWAP(a,b) (a += b,b = a - b,a -= b)
int main(){
  int flag=1;
  int N;
  int i,j,b=0;;
  scanf("%d",&N);
  int A[N];
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }

  while(flag){
    flag=0;
    for(j=N-1;j>0;j--){
      if(A[j]<A[j-1]){
	SWAP(A[j],A[j-1]);
	b++;
	flag=1;
      }
    }
  }

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

  return 0;
}



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

#include<stdio.h>
#include<stdlib.h>
#define NMIN 1
#define NMAX 100
#define AMIN 0
#define AMAX 100

int main(){
  int N,A[NMAX],i,flag=1,subA,cnt=0;
  scanf("%d",&N);
  if(N<NMIN||N>NMAX) exit(1);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
    if(A[i]<AMIN||A[i]>AMAX) exit(1);
  }
  
  while(flag){
    flag=0;
    for(i=n-1;i>=1;i--){
      if(A[i]<A[i-1]){
	subA=A[i];
	A[i]=A[i-1];
	A[i-1]=subA;
	cnt++;
	flag=1;
      }
    }
  }
   for(i=0;i<N;i++){
     if(i==N-1)
     printf("%d\n",A[i]);
     else
       printf("%d ",A[i]);
   }
  printf("%d\n",cnt);
  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:19:11: error: 'n' undeclared (first use in this function)
   19 |     for(i=n-1;i>=1;i--){
      |           ^
main.c:19:11: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int bubbleSort(A[],n){
	int flag,c=0,j,tmp;
    flag=1;
    while(flag){
    	flag=0;
    	for(j=n-1;j>0;j--){
    		if(A[j]<A[j-1]){
    			tmp=A[j];
    			A[j]=A[j-1];
    			A[j-1]=tmp;
    		
    		flag=1;
            c++;
    	}
    }
}
return c;
}

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


Compiler output:
main.c:2:16: error: unknown type name 'A'
    2 | int bubbleSort(A[],n){
      |                ^
main.c:2:20: error: unknown type name 'n'
    2 | int bubbleSort(A[],n){
      |                    ^
main.c: In function 'main':
main.c:27:13: error: implicit declaration of function 'bubbleSort' [-Wimplicit-function-declaration]
   27 |         c = bubbleSort(A,n);
      |             ^~~~~~~~~~