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

#include <stdio.h>

int Array[500000];
int H;

void maxHeapify(int i){
    int left = 2*(i+1)-1;
    int right = 2*(i+1);
    int largest;
    // select the node which has the maximum value
    if ( left <= H && Array[left] > Array[i])
        largest = left;
    else 
        largest = i;
    if ( right <= H && Array[right] > Array[largest])
        largest = right;

    if ( largest != i ){
        int temp = Array[i];
        Array[i] = Array[largest];
        Array[largest] = temp;
        maxHeapify(largest); // call recursively
    }
}

//void buildMaxHeap(A)
//2    for i = H/2 downto 1
//3        maxHeapify(A, i)

int main(){
    scanf("%d\n",&H);
    for ( int ix = 0 ; ix < H ; ix++){
        if ( ix == H-1) scanf("%d\n",&Array[ix]);
        else scanf("%d ",&Array[ix]);
        
    for ( int ix = H/2 ; ix > 0 ; ix--)
        maxHeapify(ix);
    
    return 0;
}


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

#include<stdio.h>

int n;

typedef struct node{
  long int key;
  long int parent;
  long int left;
  long int right;
}Node;

int parent(i){
  if(i==1) return -1;
  else return i/2;
}

int left(i){
  if(2*i > n) return -1;
  else return 2*i;
}

int right(i){
  if(2*i+1 > n) return -1;
  else return 2*i+1;
}

void maxHeapify(Node H[], int i){
  int l,r,largest;
  Node x;
  l = left(i);
  r = right(i);

  if(l<=n && H[l]>H[i]) largest = l;
  else largest = i;
  if(r<=n && H[r]>H[largest]) largest = r;

  if(largest!=i){
    x = H[i];
    H[i] = H[largest];
    H[largest] = x;

    maxHeapify(H,laegest);
  }
		      
}

void buildMaxHeap(Node H[]){
  int i;
  for(i=n/2;i>=1;i--) maxHeapify(H,i);
}
	       

int main(){

  int i;
  scanf("%d",&n);

  Node H[n+1];

  for(i=1;i<=n;i++){
    scanf("%d",&H[i]);
    H[i].parent = H[i].left = H[i].right = -1;
  }

  for(i=1;i<=n;i++){
    if(parent(i)!=-1) H[i].parent = H[parent(i)].key;
    if(left(i)!=-1) H[i].left = H[left(i)].key;
    if(right(i)!=-1) H[i].right = H[right(i)].key;
  }

  buildMaxHeap(H);

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



Compiler output:
main.c: In function 'parent':
main.c:12:5: error: type of 'i' defaults to 'int' [-Wimplicit-int]
   12 | int parent(i){
      |     ^~~~~~
main.c: In function 'left':
main.c:17:5: error: type of 'i' defaults to 'int' [-Wimplicit-int]
   17 | int left(i){
      |     ^~~~
main.c: In function 'right':
main.c:22:5: error: type of 'i' defaults to 'int' [-Wimplicit-int]
   22 | int right(i){
      |     ^~~~~
main.c: In function 'maxHeapify':
main.c:33:18: error: invalid operands to binary > (have 'Node' {aka 'struct node'} and 'Node' {aka 'struct node'})
   33 |   if(l<=n && H[l]>H[i]) largest = l;
      |              ~~~~^~~~~
      |               |    |
      |               |    Node {aka struct node}
      |               Node {aka struct node}
main.c:35:18: error: invalid operands to binary > (have 'Node' {aka 'struct node'} and 'Node' {aka 'struct node'})
   35 |   if(r<=n && H[r]>H[largest]) largest = r;
      |              ~~~~^~~~~~~~~~~
      |               |    |
      |               |    Node {aka struct node}
      |               Node {aka struct node}
main.c:42:18: error: 'laegest' undeclared (first use in this function); did you mean 'largest'?
   42 |     maxHeapify(H,laegest);
      |                  ^~~~~~~
      |                  largest
main.c:42:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int n;
long int H[500001];

int parent(i){
  else return i/2;
}

int left(i){
  else return 2*i;
}

int right(i){
  else return 2*i+1;
}

void maxHeapify(int i){
  int l,r,largest;
  long int x;
  l = left(i);
  r = right(i);

  if(l<=n && H[l]>H[i]) largest = l;
  else largest = i;
  if(r<=n && H[r]>H[largest]) largest = r;

  if(largest!=i){
    x = H[i];
    H[i] = H[largest];
    H[largest] = x;

    maxHeapify(largest);
  }
		      
}

void buildMaxHeap(){
  int i;
  for(i=n/2;i>=1;i--){
    maxHeapify(i);
  }
}
	       

int main(){

  int i;
  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%ld",&H[i]);
  }

  buildMaxHeap();

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



Compiler output:
main.c: In function 'parent':
main.c:6:5: error: type of 'i' defaults to 'int' [-Wimplicit-int]
    6 | int parent(i){
      |     ^~~~~~
main.c:7:3: error: 'else' without a previous 'if'
    7 |   else return i/2;
      |   ^~~~
main.c: In function 'left':
main.c:10:5: error: type of 'i' defaults to 'int' [-Wimplicit-int]
   10 | int left(i){
      |     ^~~~
main.c:11:3: error: 'else' without a previous 'if'
   11 |   else return 2*i;
      |   ^~~~
main.c: In function 'right':
main.c:14:5: error: type of 'i' defaults to 'int' [-Wimplicit-int]
   14 | int right(i){
      |     ^~~~~
main.c:15:3: error: 'else' without a previous 'if'
   15 |   else return 2*i+1;
      |   ^~~~
Language: C

#include<stdio.h>
void maxHeapify(int *,int,int);
void BUILD(int *,int);
int parent(int);
int left(int);
int right(int);
int main(){
  int i,n;
  scanf("%d",&n);
  n++;
  int H[n];
  for(i=1;i<n;i++){
    scanf("%d",&H[i]);
  }
  BUILD(H,n);
  for(i=1;i<n;i++){
    printf(" %d",H[i]);
    else printf("\n");
  }
  return 0;
}
void maxHeapify(int *H,int i,int n){
  int l;
  l = left(i);
  int r;
  r = right(i);
  int com,largest;
  // 左の子、自分、右の子で値が最大のノードを選ぶ
  if(l <= n && H[l] > H[i]) largest = l;
  else largest = i;
  if(r <= n && H[r] > H[largest]) largest = r;
  if(largest != i){
    com = H[i];
    H[i] = H[largest];
    H[largest] = com;
    maxHeapify(H, largest,n); // 再帰的に呼び出し
  }
}
void BUILD(int *H,int n){
  int i;
  for(i=n/2;i>0;i--){
    maxHeapify(H,i,n);
  }
}
int parent(int k){
  return (int)((double)k/(double)2);
}
int left(int k){
  return 2*k;
}
int right(int k){
  return 2*k+1;
}


Compiler output:
main.c: In function 'main':
main.c:18:5: error: 'else' without a previous 'if'
   18 |     else printf("\n");
      |     ^~~~
Language: C

#include<stdio.h>

int T[5000001],H;
int parent(int i){
  return i/2;
}
int left(int i){
  return i*2;
}
int right(int i){
  return i*2+1;
}
void maxHeapify(int *T,int i){
  int l,r,largest,tmp;
  l = left(i);
  r = right(i);
  if(l<=H && T[l]>T[i]){
    largest = l;
  }
  else largest = i;
  if(r<=H && T[r] > T[largest]){
    largest = r;
  }
  if(largest != i){
    tmp = T[i];
    T[i] = T[largest];
    T[largest] = tmp;
    maxHeapify(T,largest);
  }
}
void buildMaxheap(int *T){
  int i;
  for(i=H/2;i>0;i--){
    maxHeapify(T,i);
  }
}


int main(){
  int i,n;
  scanf("%d",&H);
  for(i=1;i<=H;i++){
    scanf("%d",&T[i]);
  }
  buildMaxheap(T);
  for(i=1;i<=H;i++){
    printf(" %d",T[i]);
  }
  printf("\n"):
  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:49:15: error: expected ';' before ':' token
   49 |   printf("\n"):
      |               ^
      |               ;
Language: C


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

#define MAX_HEAP_LENGTH 100

void swap(int array[], int i, int j) {
    int temp = array[i];
    array[i] = array[j];
    array[j] = temp;
}
void printArray(int array[], int length) {
    for (int i = 0; i < length; i++) {
        /*if (i) */printf(" ");
        printf("%d", array[i]);
    }
}

typedef struct {
    int * array;
    int heap_size;
    int length;
} Heap;

Heap createHeap(int length) {
    Heap heap;
    
    heap.array = (int *)malloc((length+1) * sizeof(int));
    heap.array[0] = NULL; // NOT USED
    heap.heap_size = heap.length = length;
    
    return heap;
}

int parentOfIndex(int index) {
    return index/2;
}
int leftOfIndex(int index) {
    return 2*index;
}
int rightOfIndex(int index) {
    return 2*index+1;
}

void maxHeapify(Heap heap, int iThis) {
    int iLeft = leftOfIndex(iThis);
    int iRight = rightOfIndex(iThis);
    
    int iLargest = (iLeft <= heap.heap_size && heap.array[iLeft] > heap.array[iThis] ? iLeft : iThis);
    if (iRight <= heap.heap_size && heap.array[iRight] > heap.array[iLargest]) iLargest = iRight;
    
    if (iLargest != iThis) {
        swap(heap.array, iThis, iLargest);
        // iLargest is no longer the index for largest value within the trinode.
        maxHeapify(heap, iLargest);
    }
}
void buildMaxHeap(Heap heap) {
    heap.heap_size = heap.length;
    
    for (int i = heap.length/2; i >= 1; i--)
        maxHeapify(heap, i);
}
void heapSort(Heap heap) {
    buildMaxHeap(heap);
    
    for (int i = heap.length; i >= 2; i--) {
        swap(heap.array, 1, i);
        heap.heap_size--;
        maxHeapify(heap, 1);
    }
}


int main(int argc, char** argv) {
    int nNode;
    scanf("%d", &nNode);
    
    Heap heap = createHeap(nNode);
    // 1-origin
    
    for (int i = 1; i <= nNode; i++)
        scanf("%d", &(heap.array[i]));
    
    buildMaxHeap(heap);
    
    for (int i = 1; i <= nNode; i++)
        scanf("%d", &(heap.array[i]));
    
    printArray(heap.array);
    
//    for (int i = 1; i <= nNode; i++) {
//        printf("node %d: ", i);
//        printf("key = %d, ", heap.array[i]);
//        
//        if (i/2 > 0)
//            printf("parent key = %d, ", heap.array[i/2]);
//        
//        if (2*i <= heap.length)
//            printf("left key = %d, ", heap.array[2*i]);
//        
//        if (2*i+1 <= heap.length)
//            printf("right key = %d, ", heap.array[2*i+1]);
//        
//        printf("\n");
//    }

    return (EXIT_SUCCESS);
}




Compiler output:
main.c: In function 'createHeap':
main.c:29:19: error: assignment to 'int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
   29 |     heap.array[0] = NULL; // NOT USED
      |                   ^
main.c: In function 'main':
main.c:90:5: error: too few arguments to function 'printArray'
   90 |     printArray(heap.array);
      |     ^~~~~~~~~~
main.c:12:6: note: declared here
   12 | void printArray(int array[], int length) {
      |      ^~~~~~~~~~
Language: C

#include<stdio.h>
#define MAX 2000000

int n,a[MAX+1];

int main() {
  int i;

  scanf("%d",&n);
  for(i = 1 ; i <= n ; i++) {
    scanf("%d",&A[i]);
  }
  for(i = n / 2 ; i >= 1 ; i--) {
    maxHeapify(i);
  }
  
  for(i = 1 ; i <= n ; i++) {
    printf(" %d", A[i]);
  }
  printf("\n");
  return 0;
}

void maxHeapify(int i) {
  int l,r,largest,tmp;

  l = 2 * i;
  r = 2 * i + 1;

  if(l <= n && A[l] > A[i])
    largest = l;
  else largest = i;
  if(r <= n && A[r] > A[largest])
    largest = r;
  if (largest != i) {
    tmp = A[i];
    A[i] = A[largest];
    A[largest] = tmp;
    maxHeapify(largest);
  }
}



Compiler output:
main.c: In function 'main':
main.c:11:17: error: 'A' undeclared (first use in this function)
   11 |     scanf("%d",&A[i]);
      |                 ^
main.c:11:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:5: error: implicit declaration of function 'maxHeapify' [-Wimplicit-function-declaration]
   14 |     maxHeapify(i);
      |     ^~~~~~~~~~
main.c: At top level:
main.c:24:6: warning: conflicting types for 'maxHeapify'; have 'void(int)'
   24 | void maxHeapify(int i) {
      |      ^~~~~~~~~~
main.c:14:5: note: previous implicit declaration of 'maxHeapify' with type 'void(int)'
   14 |     maxHeapify(i);
      |     ^~~~~~~~~~
main.c: In function 'maxHeapify':
main.c:30:16: error: 'A' undeclared (first use in this function)
   30 |   if(l <= n && A[l] > A[i])
      |                ^
Language: C

#include<stdio.h>                                                                
 
 int H;
 maxHeapify(int* A,int i){
     int l = A[i*2];
     int r = A[i*2+1];
     int m;
     if( l ≤ H and A[l] > A[i]){
         int largest = l;
     }
     else{
         int largest = i;
     }
     if( r ≤ H and A[r] > A[largest]){
         int largest = r;
     }
     if(largest != i){
         m = A[i];
         A[i] = A[largest];
         A[largest] = m;
         maxHeapify(A, largest);
     }
 }
 
 buildMaxHeap(int* A){
     int i;
     for(i = H/2 ; i >= 1 ; i--){
         maxHeapify(A,i);
     }
 }
 
 int main(){
     int i;
     scanf("%d",&H);
     int tree[H+1];
     for(i = 1 ; i <= H ; i++){
        scanf("%d",&tree[i]);
     }
     buildMaxHeap(H);
     return 0;
 }      



Compiler output:
main.c:4:2: error: return type defaults to 'int' [-Wimplicit-int]
    4 |  maxHeapify(int* A,int i){
      |  ^~~~~~~~~~
main.c: In function 'maxHeapify':
main.c:8:12: error: stray '\342' in program
    8 |      if( l <U+2264> H and A[l] > A[i]){
      |            ^~~~~~~~
main.c:8:11: error: expected ')' before 'H'
    8 |      if( l ≤ H and A[l] > A[i]){
      |        ~  ^  ~
      |           )
main.c:14:12: error: stray '\342' in program
   14 |      if( r <U+2264> H and A[r] > A[largest]){
      |            ^~~~~~~~
main.c:14:11: error: expected ')' before 'H'
   14 |      if( r ≤ H and A[r] > A[largest]){
      |        ~  ^  ~
      |           )
main.c:17:9: error: 'largest' undeclared (first use in this function)
   17 |      if(largest != i){
      |         ^~~~~~~
main.c:17:9: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:25:2: error: return type defaults to 'int' [-Wimplicit-int]
   25 |  buildMaxHeap(int* A){
      |  ^~~~~~~~~~~~
main.c: In function 'main':
main.c:39:19: error: passing argument 1 of 'buildMaxHeap' makes pointer from integer without a cast [-Wint-conversion]
   39 |      buildMaxHeap(H);
      |                   ^
      |                   |
      |                   int
main.c:25:20: note: expected 'int *' but argument is of type 'int'
   25 |  buildMaxHeap(int* A){
      |               ~~~~~^
Language: C

#include<stdio.h>
#define MAX 2000000
int H,A[MAX+1];
int parent(int i){
  return i/2;
}
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i+1;
}

void maxHeapity(int A[],int i){
  int l,r,large,t;
  l=left(i);
  r=right(i);
  if(l<=H&&A[l]>A[i])large=l;
  else large=i;
  if(r<=H&&A[r]>A[large])large=r;
  if(large!=i){
    t=A[i];
    A[i]=A[large];
    A[large]=t;
    maxHeapity(A,large);
  }
}

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

  for(i=H/2;i>=1;i--){
    maxHeapity(A,i);
  }

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

  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:41:12: error: implicit declaration of function 'pritnf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   41 |     if(i>1)pritnf(" ");
      |            ^~~~~~
      |            printf
Language: C

#include <stdio.h>
#define MAX 100000

int H;

void maxHeapify(int *B,int j)
{
  int l,r,largest;
  int *temp;
  l = 2 * j;
  r = 2 * j + 1;
  if(l <= H && B[l] > B[j])
    largest = l;
  else
    largest = j;
  if(r <= H && B[r] > B[largest])
    largest = r;
  if(largest != j)
    {
      temp = &B[j];
      &B[j] = &B[largest];
      &B[largest] = temp;
      maxHeapify(B,largest);
    }
};

int main()
{
  int i,A[MAX];
  
  scanf("%d",&H);
  for(i = 1; i <= H; i++)
    scanf("%d",&A[i]);
  for(i = H/2; i >= 1; i--)
    maxHeapify(A,i);
  for(i = 1;i <= H; i++)
      printf(" %d",A[i]);
  printf("\n");
  
  return 0;
}



Compiler output:
main.c: In function 'maxHeapify':
main.c:21:13: error: lvalue required as left operand of assignment
   21 |       &B[j] = &B[largest];
      |             ^
main.c:22:19: error: lvalue required as left operand of assignment
   22 |       &B[largest] = temp;
      |                   ^
Language: C

#include<stdio.h>
#define MAX 5000
int H[MAX];
maxHeapify(int *, int);
buildMaxHeap(int *);
int main() {
	int h,i;

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

	buildMaxHeap(H, h);

	for (i = 0; i < h; i++) {
		printf(" %d", H[i]);
	}
	return 0;
}

maxHeapify(int* A, int i,int H) {
	int l;
	int r;
	int largest;
	int dummy;
	l = A[2 * i];
	r = A[2 * i + 1];
	if (l <= H && A[l] > A[i]) {
		largest = l;
	}
	else largest = i;
	if (r <= H && A[r] > A[largest]) {
		largest = r;
	}
	if (largest != i) {
		dummy = A[i];
		A[i] = A[largest];
		A[largest] = dummy;
		maxHeapify(A, largest, H);
	}
}

buildMaxHeap(int* A,int H){
	int i;
	for (i = 0; i = H / 2; i--) {
		maxHeapify(A, i,H);
	}
}


Compiler output:
main.c:4:1: warning: data definition has no type or storage class
    4 | maxHeapify(int *, int);
      | ^~~~~~~~~~
main.c:4:1: error: type defaults to 'int' in declaration of 'maxHeapify' [-Wimplicit-int]
main.c:5:1: warning: data definition has no type or storage class
    5 | buildMaxHeap(int *);
      | ^~~~~~~~~~~~
main.c:5:1: error: type defaults to 'int' in declaration of 'buildMaxHeap' [-Wimplicit-int]
main.c: In function 'main':
main.c:14:9: error: too many arguments to function 'buildMaxHeap'
   14 |         buildMaxHeap(H, h);
      |         ^~~~~~~~~~~~
main.c:5:1: note: declared here
    5 | buildMaxHeap(int *);
      | ^~~~~~~~~~~~
main.c: At top level:
main.c:22:1: error: return type defaults to 'int' [-Wimplicit-int]
   22 | maxHeapify(int* A, int i,int H) {
      | ^~~~~~~~~~
main.c:22:1: error: conflicting types for 'maxHeapify'; have 'int(int *, int,  int)'
main.c:4:1: note: previous declaration of 'maxHeapify' with type 'int(int *, int)'
    4 | maxHeapify(int *, int);
      | ^~~~~~~~~~
main.c:44:1: error: return type defaults to 'int' [-Wimplicit-int]
   44 | buildMaxHeap(int* A,int H){
      | ^~~~~~~~~~~~
main.c:44:1: error: conflicting types for 'buildMaxHeap'; have 'int(int *, int)'
main.c:5:1: note: previous declaration of 'buildMaxHeap' with type 'int(int *)'
    5 | buildMaxHeap(int *);
      | ^~~~~~~~~~~~
Language: C

#include<stdio.h>
#define MAX 5000
int H[MAX];
maxHeapify(int *, int);
buildMaxHeap(int *,int);
int main() {
	int h,i;

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

	buildMaxHeap(H, h);

	for (i = 0; i < h; i++) {
		printf(" %d", H[i]);
	}
	return 0;
}

maxHeapify(int* A, int i,int H) {
	int l;
	int r;
	int largest;
	int dummy;
	l = A[2 * i];
	r = A[2 * i + 1];
	if (l <= H && A[l] > A[i]) {
		largest = l;
	}
	else largest = i;
	if (r <= H && A[r] > A[largest]) {
		largest = r;
	}
	if (largest != i) {
		dummy = A[i];
		A[i] = A[largest];
		A[largest] = dummy;
		maxHeapify(A, largest, H);
	}
}

buildMaxHeap(int* A,int H){
	int i;
	for (i = 0; i = H / 2; i--) {
		maxHeapify(A, i,H);
	}
}


Compiler output:
main.c:4:1: warning: data definition has no type or storage class
    4 | maxHeapify(int *, int);
      | ^~~~~~~~~~
main.c:4:1: error: type defaults to 'int' in declaration of 'maxHeapify' [-Wimplicit-int]
main.c:5:1: warning: data definition has no type or storage class
    5 | buildMaxHeap(int *,int);
      | ^~~~~~~~~~~~
main.c:5:1: error: type defaults to 'int' in declaration of 'buildMaxHeap' [-Wimplicit-int]
main.c:22:1: error: return type defaults to 'int' [-Wimplicit-int]
   22 | maxHeapify(int* A, int i,int H) {
      | ^~~~~~~~~~
main.c:22:1: error: conflicting types for 'maxHeapify'; have 'int(int *, int,  int)'
main.c:4:1: note: previous declaration of 'maxHeapify' with type 'int(int *, int)'
    4 | maxHeapify(int *, int);
      | ^~~~~~~~~~
main.c:44:1: error: return type defaults to 'int' [-Wimplicit-int]
   44 | buildMaxHeap(int* A,int H){
      | ^~~~~~~~~~~~
Language: C

#include <stdio.h>
#define MAX 500000

int n,A[MAX+1];

void Max(int i){
    int l,r,large;
    l=2*i;
    r=2*i+1;

    if(l<=n&&A[l]>A[i])
       large=l;
    else large=i;
    if(l<=n&&A[r]>A[large])
       large=r;
       
       if(large!=i){
           swp(A[i],A[large]);
           Max(large);
       }
}

int main(){
    int i;
    scanf("%d",&n);
    
    for(i=1;i<=n;i++)
       scanf("%d",&A[i]);
       
    for(i=n/2;i>=1;i--)Max(i);
    
    for(i=1;i<=n;i++)   {
       printf(" %d",A[i]);
    }
    printf("\n");
    return 0;

}


Compiler output:
main.c: In function 'Max':
main.c:18:12: error: implicit declaration of function 'swp' [-Wimplicit-function-declaration]
   18 |            swp(A[i],A[large]);
      |            ^~~
Language: C

#include <stdio.h>
#define MAX 500000

int n,A[MAX+1];

void Max(int i){
    int l,r,large;
    l=2*i;
    r=2*i+1;

    if(l<=n&&A[l]>A[i])
       large=l;
    else large=i;
    if(l<=n&&A[r]>A[large])
       large=r;
       
       if(large!=i){
           swap(A[i],A[large]);
           Max(large);
       }
}

int main(){
    int i;
    scanf("%d",&n);
    
    for(i=1;i<=n;i++)
       scanf("%d",&A[i]);
       
    for(i=n/2;i>=1;i--)Max(i);
    
    for(i=1;i<=n;i++)   {
       printf(" %d",A[i]);
    }
    printf("\n");
    return 0;

}


Compiler output:
main.c: In function 'Max':
main.c:18:12: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   18 |            swap(A[i],A[large]);
      |            ^~~~
Language: C

#include<stdio.h>

void maxheap(int);
int num,array[2000001];

int main(){

   int i;
  scanf("%d",&num);
  for(i = 1;i <= num;i++){
    scanf("%d",&array[i]);
  }
  for(i = num / 2;i >= 1;i--){
    maxheap(i);
  }
  for(i = 1;i <= num;i++){
    printf(" %d ",array[i]);
  }
  return 0;
}

void maxheap(int i){
  int left,right,largest;

  left = 2 * i;
  right = 2 * i + 1;

  if(left <= num && array[left] > array[i]){
    largest = left;
  }
  else{
    largest = i;
  }
  if(right <= num && array[largest]){
    largest = right;
  }
  if(largest != i){
    swap(array[i],array[largest]);
    maxheap(largest);
  }
}



Compiler output:
main.c: In function 'maxheap':
main.c:38:5: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   38 |     swap(array[i],array[largest]);
      |     ^~~~
Language: C

#include<stdio.h>                                                                
 
 int H;
void maxHeapify(int* A,int i){
     int l = A[i*2];
     int r = A[i*2+1];
     int m;
     if( l <= H && A[l] > A[i]){
         int largest = l;
     }
     else{
         int largest = i;
     }
     if( r <= H && A[r] > A[largest]){
         int largest = r;
     }
     if(largest != i){
         m = A[i];
         A[i] = A[largest];
         A[largest] = m;
         maxHeapify(A, largest);
     }
 }
 
void buildMaxHeap(int* A){
     int i;
     for(i = H/2 ; i >= 1 ; i--){
         maxHeapify(A,i);
     }
 }
 
 int main(){
     int i;
     scanf("%d",&H);
     int tree[H+1];
     for(i = 1 ; i <= H ; i++){
        scanf("%d",&tree[i]);
     }
     buildMaxHeap(H);
     for(i = 1 ; i <= H ; i++){
        printf(" %d",tree[i]);
     }
     return 0;
 }      



Compiler output:
main.c: In function 'maxHeapify':
main.c:14:29: error: 'largest' undeclared (first use in this function)
   14 |      if( r <= H && A[r] > A[largest]){
      |                             ^~~~~~~
main.c:14:29: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:39:19: error: passing argument 1 of 'buildMaxHeap' makes pointer from integer without a cast [-Wint-conversion]
   39 |      buildMaxHeap(H);
      |                   ^
      |                   |
      |                   int
main.c:25:24: note: expected 'int *' but argument is of type 'int'
   25 | void buildMaxHeap(int* A){
      |                   ~~~~~^
Language: C

#include <stdio.h>
#define MAX 500000

int n,A[MAX+1];

void  swap(int *x, int *y)
{
    int  work;        /* 作業用 */

    work = *x;        /* xの値を一時保存 */
    *x = *y;          /* xの値をyの値に書き換える */
    *y = work;        /* yの値をxの値に書き換える */
}

void Max(int i){
    int l,r,large;
    l=2*i;
    r=2*i+1;

    if(l<=n&&A[l]>A[i])
       large=l;
    else large=i;
    if(l<=n&&A[r]>A[large])
       large=r;
       
       if(large!=i){
           swap(*A[i],*A[large]);
           Max(large);
       }
}

int main(){
    int i;
    scanf("%d",&n);
    
    for(i=1;i<=n;i++)
       scanf("%d",&A[i]);
       
    for(i=n/2;i>=1;i--)Max(i);
    
    for(i=1;i<=n;i++)   {
       printf(" %d",A[i]);
    }
    printf("\n");
    return 0;

}


Compiler output:
main.c: In function 'Max':
main.c:27:17: error: invalid type argument of unary '*' (have 'int')
   27 |            swap(*A[i],*A[large]);
      |                 ^~~~~
main.c:27:23: error: invalid type argument of unary '*' (have 'int')
   27 |            swap(*A[i],*A[large]);
      |                       ^~~~~~~~~
Language: C

#include <stdio.h>
#define MAX 500000
void swap(int*, int*)
void Max(int)
int n,A[MAX+1];

void  swap(int *x, int *y)
{
    int  work;        /* 作業用 */

    work = *x;        /* xの値を一時保存 */
    *x = *y;          /* xの値をyの値に書き換える */
    *y = work;        /* yの値をxの値に書き換える */
}

void Max(int i){
    int l,r,large;
    l=2*i;
    r=2*i+1;

    if(l<=n&&A[l]>A[i])
       large=l;
    else large=i;
    if(l<=n&&A[r]>A[large])
       large=r;
       
       if(large!=i){
           swap(*A[i],*A[large]);
           Max(large);
       }
}

int main(){
    int i;
    scanf("%d",&n);
    
    for(i=1;i<=n;i++)
       scanf("%d",&A[i]);
       
    for(i=n/2;i>=1;i--)Max(i);
    
    for(i=1;i<=n;i++)   {
       printf(" %d",A[i]);
    }
    printf("\n");
    return 0;

}


Compiler output:
main.c: In function 'swap':
main.c:5:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
    5 | int n,A[MAX+1];
      | ^~~
main.c:8:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    8 | {
      | ^
main.c:16:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   16 | void Max(int i){
      |                ^
main.c:33:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   33 | int main(){
      |           ^
main.c:49: error: expected '{' at end of input
Language: C

#include<stdio.h>
#define max 200000;
int n,A[max+1],change;
void maxheapfiy(int i){
  int r,l,largest;
  l=2*i;
  r=2*i+1;
  if(l<=n && A[l]>A[i])largest=l;
  else largest =i;
  if(largest!=i){
    change = A[i];
    A[i]=A[largest];
    A[largest]= change;
    maxheapfiy(largest);
  }
}
    int main(){
      scaanf("%d",&n);
      for(i=1,i<=n;i++){
        scanf("%d",&A[i]);
      }
      for(i=n/2;i>=1;i--)maxheapfiy(i);
      for(i=1;i<=n;i++){
        printf(" %d",A[i]);
      }
      printf("\n");
      return 0;
    }



Compiler output:
main.c:2:19: error: expected ']' before ';' token
    2 | #define max 200000;
      |                   ^
main.c:3:9: note: in expansion of macro 'max'
    3 | int n,A[max+1],change;
      |         ^~~
main.c: In function 'maxheapfiy':
main.c:8:14: error: 'A' undeclared (first use in this function)
    8 |   if(l<=n && A[l]>A[i])largest=l;
      |              ^
main.c:8:14: note: each undeclared identifier is reported only once for each function it appears in
main.c:11:5: error: 'change' undeclared (first use in this function)
   11 |     change = A[i];
      |     ^~~~~~
main.c: In function 'main':
main.c:18:7: error: implicit declaration of function 'scaanf'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   18 |       scaanf("%d",&n);
      |       ^~~~~~
      |       scanf
main.c:19:11: error: 'i' undeclared (first use in this function)
   19 |       for(i=1,i<=n;i++){
      |           ^
main.c:19:23: error: expected ';' before ')' token
   19 |       for(i=1,i<=n;i++){
      |                       ^
      |                       ;
main.c:20:21: error: 'A' undeclared (first use in this function)
   20 |         scanf("%d",&A[i]);
      |                     ^
Language: C

#include<stdio.h>
#define max 200000
int n,A[max+1];
void maxheapfiy(int A[],int i){
  int r,l,largest,change;
  l=2*i;
  r=2*i+1;
  if(l<=n && A[l]>A[i])largest=l;
  else largest =i;
  if(r<=n && A[r]>A[largest])largest =r;
  if(largest!=i){
    change = A[i];
    A[i]=A[largest];
    A[largest]= change;
    maxheapfiy(largest);
  }
}
    int main(){
      int i;
      scanf("%d",&n);
      for(i=1;i<=n;i++)scanf("%d",&A[i]);
      for(i=n/2;i>=1;i--)maxheapfiy(A[],i);
      for(i=1;i<=n;i++)printf(" %d",A[i]);
      printf("\n");
      return 0;
    }



Compiler output:
main.c: In function 'maxheapfiy':
main.c:15:16: error: passing argument 1 of 'maxheapfiy' makes pointer from integer without a cast [-Wint-conversion]
   15 |     maxheapfiy(largest);
      |                ^~~~~~~
      |                |
      |                int
main.c:4:21: note: expected 'int *' but argument is of type 'int'
    4 | void maxheapfiy(int A[],int i){
      |                 ~~~~^~~
main.c:15:5: error: too few arguments to function 'maxheapfiy'
   15 |     maxheapfiy(largest);
      |     ^~~~~~~~~~
main.c:4:6: note: declared here
    4 | void maxheapfiy(int A[],int i){
      |      ^~~~~~~~~~
main.c: In function 'main':
main.c:22:39: error: expected expression before ']' token
   22 |       for(i=n/2;i>=1;i--)maxheapfiy(A[],i);
      |                                       ^
Language: C

#include <stdio.h>
#define MAX 500000
int n,A[MAX+1];

void swap(int*, int*);
void Max(int);



void  swap(int *x, int *y)
{
    int  work;        /* 作業用 */

    work = *x;        /* xの値を一時保存 */
    *x = *y;          /* xの値をyの値に書き換える */
    *y = work;        /* yの値をxの値に書き換える */
}

void Max(int i){
    int l,r,large;
    l=2*i;
    r=2*i+1;

    if(l<=n&&A[l]>A[i])
       large=l;
    else large=i;
    if(l<=n&&A[r]>A[large])
       large=r;
       
       if(large!=i){
           swap(*A[i],*A[large]);
           Max(large);
       }
}

int main(){
    int i;
    scanf("%d",&n);
    
    for(i=1;i<=n;i++)
       scanf("%d",&A[i]);
       
    for(i=n/2;i>=1;i--)Max(i);
    
    for(i=1;i<=n;i++)   {
       printf(" %d",A[i]);
    }
    printf("\n");
    return 0;

}


Compiler output:
main.c: In function 'Max':
main.c:31:17: error: invalid type argument of unary '*' (have 'int')
   31 |            swap(*A[i],*A[large]);
      |                 ^~~~~
main.c:31:23: error: invalid type argument of unary '*' (have 'int')
   31 |            swap(*A[i],*A[large]);
      |                       ^~~~~~~~~
Language: C

#include <stdio.h>
#define MAX 500000


void swap(int*, int*);
void Max(int);

int n,A[MAX+1];

void  swap(int *x, int *y)
{
    int  work;        /* 作業用 */

    work = *x;        /* xの値を一時保存 */
    *x = *y;          /* xの値をyの値に書き換える */
    *y = work;        /* yの値をxの値に書き換える */
}

void Max(int i){
    int l,r,large;
    l=2*i;
    r=2*i+1;

    if(l<=n&&A[l]>A[i])
       large=l;
    else large=i;
    if(l<=n&&A[r]>A[large])
       large=r;
       
       if(large!=i){
           swap(*A[i],*A[large]);
           Max(large);
       }
}

int main(){
    int i;
    scanf("%d",&n);
    
    for(i=1;i<=n;i++)
       scanf("%d",&A[i]);
       
    for(i=n/2;i>=1;i--)Max(i);
    
    for(i=1;i<=n;i++)   {
       printf(" %d",A[i]);
    }
    printf("\n");
    return 0;

}


Compiler output:
main.c: In function 'Max':
main.c:31:17: error: invalid type argument of unary '*' (have 'int')
   31 |            swap(*A[i],*A[large]);
      |                 ^~~~~
main.c:31:23: error: invalid type argument of unary '*' (have 'int')
   31 |            swap(*A[i],*A[large]);
      |                       ^~~~~~~~~
Language: C

#include <stdio.h>
#define MAX 500000

int n,A[MAX+1];

void swap(int*, int*);
void Max(int);



void  swap(int *x, int *y)
{
    int  work;        /* 作業用 */

    work = *x;        /* xの値を一時保存 */
    *x = *y;          /* xの値をyの値に書き換える */
    *y = work;        /* yの値をxの値に書き換える */
}

void Max(int i){
    int l,r,large;
    l=2*i;
    r=2*i+1;

    if(l<=n&&A[l]>A[i])
       large=l;
    else large=i;
    if(l<=n&&A[r]>A[large])
       large=r;
       
       if(large!=i){
           swap(*A[i],*A[large]);
           Max(large);
       }
}

int main(){
    int i;
    scanf("%d",&n);
    
    for(i=1;i<=n;i++)
       scanf("%d",&A[i]);
       
    for(i=n/2;i>=1;i--)Max(i);
    
    for(i=1;i<=n;i++)   {
       printf(" %d",A[i]);
    }
    printf("\n");
    return 0;

}


Compiler output:
main.c: In function 'Max':
main.c:32:17: error: invalid type argument of unary '*' (have 'int')
   32 |            swap(*A[i],*A[large]);
      |                 ^~~~~
main.c:32:23: error: invalid type argument of unary '*' (have 'int')
   32 |            swap(*A[i],*A[large]);
      |                       ^~~~~~~~~
Language: C

#include <stdio.h>
#define MAX 500000

int n,A[MAX+1];

void swap(*int,*int);
void Max(int);



void  swap(int *x, int *y)
{
    int  work;        /* 作業用 */

    work = *x;        /* xの値を一時保存 */
    *x = *y;          /* xの値をyの値に書き換える */
    *y = work;        /* yの値をxの値に書き換える */
}

void Max(int i){
    int l,r,large;
    l=2*i;
    r=2*i+1;

    if(l<=n&&A[l]>A[i])
       large=l;
    else large=i;
    if(l<=n&&A[r]>A[large])
       large=r;
       
       if(large!=i){
           swap(*A[i],*A[large]);
           Max(large);
       }
}

int main(){
    int i;
    scanf("%d",&n);
    
    for(i=1;i<=n;i++)
       scanf("%d",&A[i]);
       
    for(i=n/2;i>=1;i--)Max(i);
    
    for(i=1;i<=n;i++)   {
       printf(" %d",A[i]);
    }
    printf("\n");
    return 0;

}


Compiler output:
main.c:6:11: error: expected declaration specifiers or '...' before '*' token
    6 | void swap(*int,*int);
      |           ^
main.c:6:16: error: expected declaration specifiers or '...' before '*' token
    6 | void swap(*int,*int);
      |                ^
main.c: In function 'Max':
main.c:32:17: error: invalid type argument of unary '*' (have 'int')
   32 |            swap(*A[i],*A[large]);
      |                 ^~~~~
main.c:32:23: error: invalid type argument of unary '*' (have 'int')
   32 |            swap(*A[i],*A[large]);
      |                       ^~~~~~~~~
Language: C

#include <stdio.h>
#define MAX 500000

int n,A[MAX+1];

void swap(int*,int*);
void Max(int);



void  swap(int *x, int *y)
{
    int  work;        /* 作業用 */

    work = *x;        /* xの値を一時保存 */
    *x = *y;          /* xの値をyの値に書き換える */
    *y = work;        /* yの値をxの値に書き換える */
}

void Max(int i){
    int l,r,large;
    l=2*i;
    r=2*i+1;

    if(l<=n&&A[l]>A[i])
       large=l;
    else large=i;
    if(l<=n&&A[r]>A[large])
       large=r;
       
       if(large!=i){
           swap(*A[i],*A[large]);
           Max(large);
       }
}

int main(){
    int i;
    scanf("%d",&n);
    
    for(i=1;i<=n;i++)
       scanf("%d",&A[i]);
       
    for(i=n/2;i>=1;i--)Max(i);
    
    for(i=1;i<=n;i++)   {
       printf(" %d",A[i]);
    }
    printf("\n");
    return 0;

}


Compiler output:
main.c: In function 'Max':
main.c:32:17: error: invalid type argument of unary '*' (have 'int')
   32 |            swap(*A[i],*A[large]);
      |                 ^~~~~
main.c:32:23: error: invalid type argument of unary '*' (have 'int')
   32 |            swap(*A[i],*A[large]);
      |                       ^~~~~~~~~
Language: C

#include<stdio.h>
#define 500000
int H;
void maxHeapify(int *A;int i){
    int l,r,largest;
    int v;
    l=2*i;
    r=2*i+1;
    if(l<=H && A[l]>A[i])largest = l;
    else largest = i;
    if(r<=H && A[r]>A[largest])largest = r;
    if(largest!=i){
        v=A[i];
        A[i]=A[largest];
        A[largest]=v;
        maxHeapify(A,largest);
    }
}
void MaxHeap(int *A){
    int i;
    for(i=H/2;i>=1;i--){
        maxHeapify(A,i);
    }
}
int main(){
    int Heap[MAX+1];
    int i;
    scanf("%d",&H);
    for(i=1;i<=H;i++){
        scanf("%d",&Heap[i]);
    }
    MaxHeap(Heap);
    for(i=1;i<=H;i++){
        printf(" %d",Heap[i]);
    }
    printf("\n");
    return 0;
}


Compiler output:
main.c:2:9: error: macro names must be identifiers
    2 | #define 500000
      |         ^~~~~~
main.c:4:22: error: parameter 'A' has just a forward declaration
    4 | void maxHeapify(int *A;int i){
      |                 ~~~~~^
main.c: In function 'maxHeapify':
main.c:9:16: error: 'A' undeclared (first use in this function)
    9 |     if(l<=H && A[l]>A[i])largest = l;
      |                ^
main.c:9:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:9: error: too many arguments to function 'maxHeapify'
   16 |         maxHeapify(A,largest);
      |         ^~~~~~~~~~
main.c:4:6: note: declared here
    4 | void maxHeapify(int *A;int i){
      |      ^~~~~~~~~~
main.c: In function 'MaxHeap':
main.c:22:20: error: passing argument 1 of 'maxHeapify' makes integer from pointer without a cast [-Wint-conversion]
   22 |         maxHeapify(A,i);
      |                    ^
      |                    |
      |                    int *
main.c:4:28: note: expected 'int' but argument is of type 'int *'
    4 | void maxHeapify(int *A;int i){
      |                        ~~~~^
main.c:22:9: error: too many arguments to function 'maxHeapify'
   22 |         maxHeapify(A,i);
      |         ^~~~~~~~~~
main.c:4:6: note: declared here
    4 | void maxHeapify(int *A;int i){
      |      ^~~~~~~~~~
main.c: In function 'main':
main.c:26:14: error: 'MAX' undeclared (first use in this function)
   26 |     int Heap[MAX+1];
      |              ^~~
Language: C

#include <stdio.h>
int n,hai[2000001];

void MaxH(int a){
  int x,y,L,change,left,right;
  left=2*a;
  right=2*a+1;

  if(n>=left && hai[left]>hai[a]){
    L=left;
  }
  else{L=a;}

  if(n>=right && hai[right]>hai[L]){
    L=right;
  }
  if(L!=a){
    change=hai[a];
    hai[a]=hai[L];
    hai[L]=change;
    MaxH(L);
  }
}

int main(){
  int i,j,k;

  scanf("%d",&n);

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

  for(i=n/2; i>=1;i--){
    MaxH(i);
  }

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



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

#include<stdio.h>
#define 500000
int H;
void maxHeapify(int *A,int i){
    int l,r,largest;
    int v;
    l=2*i;
    r=2*i+1;
    if(l<=H && A[l]>A[i])largest = l;
    else largest = i;
    if(r<=H && A[r]>A[largest])largest = r;
    if(largest!=i){
        v=A[i];
        A[i]=A[largest];
        A[largest]=v;
        maxHeapify(A,largest);
    }
}
void MaxHeap(int *A){
    int i;
    for(i=H/2;i>=1;i--){
        maxHeapify(A,i);
    }
}
int main(){
    int Heap[MAX+1];
    int i;
    scanf("%d",&H);
    for(i=1;i<=H;i++){
        scanf("%d",&Heap[i]);
    }
    MaxHeap(Heap);
    for(i=1;i<=H;i++){
        printf(" %d",Heap[i]);
    }
    printf("\n");
    return 0;
}


Compiler output:
main.c:2:9: error: macro names must be identifiers
    2 | #define 500000
      |         ^~~~~~
main.c: In function 'main':
main.c:26:14: error: 'MAX' undeclared (first use in this function)
   26 |     int Heap[MAX+1];
      |              ^~~
main.c:26:14: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#include <stdlib.h>
#define MAX 2000000

int H,A[MAX+1];

void maxHeapify(int i){
  int l,r,largest;
  l=2*i;
  r=2*i+1;


  if(l<=H && A[l]>A[i]) largest=1;
  else largest=i;
  if(r<=H && A[r]>A[largest]){
    largest=r;
  }

  if(largest != i){
    swap(A[i],A[largest]);
    maxHeapify(largest);
  }
}

int main(){

  scanf("%d",&H);

  int i;
  for(i=1;i<=H;i++){
    scanf("%d",&A[i]);
  }

  for(i=H/2;i>=1;i--){
    maxHeapify(i);
  }
  for(i=1;i<=H;i++){
    printf(" %d",A[i]);
  }
  printf("\n");


  return 0;
}



Compiler output:
main.c: In function 'maxHeapify':
main.c:20:5: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   20 |     swap(A[i],A[largest]);
      |     ^~~~
Language: C

#include <stdio.h>

#define M 500010
int A[M];
int H;

int parent(int);
int left(int);
int right(int);
void maxheap(int);
void bmaxheap(void);

int main(int argc,char *argv[]){
  int i,num;
  scanf("%d",&num);
  H=num;
  for(i=1;i<=num++){
    scanf("%d",&A[i]);
  }
 
  bmaxheap();
 
  for(i=1;i<=num;i++){
    printf(" %d",A[i]);
  }
  printf("\n");
  return 0;
}

int parent(int i){
  return i/2;
}
 
int left(int i){
  return 2*i;
}
 
int right(int i){
  return 2*i+1;
}

void maxheap(int i){
  int l,r,largest,tmp;
  l=left(i);
  r=right(i);
  if(l<=H && A[l]>A[i]) largest=l;
  else largest=i;
 
  if(r<=H && A[r]>A[largest])  largest=r;
   
  if(largest!=i){
    tmp=A[i];
    A[i]=A[largest];
    A[largest]=tmp;
    maxheap(largest);
  }
}
 
void bmaxheap(void){
  int i;
  for(i=H/2;i>0;i--){
    maxheap(i);
  }
}



Compiler output:
main.c: In function 'main':
main.c:17:19: error: expected ';' before ')' token
   17 |   for(i=1;i<=num++){
      |                   ^
      |                   ;
Language: C

#include<stdio.h>
#define NIL 500003
 
int A[500001],n;
 
int main(){
  int i;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
   scanf("%d",&A[i]);
  }
  
  for(i=n+1;i<500001;i++){
  A[i] = NIL;
  }
  for(i=n/2;i>=1;i--){
  
   maxHeapify(i);
  }
  for(i=1;i<=n;i++)
    {
  printf(" %d",A[i]);
    }  
printf("\n");
  
}

int left(int i){
return i*2;
}

int right(int i){
return i*2+1;
}

void exchange(int *a,int *b){
  int tmp=*a;
  *a=*b;
  *b=tmp;
}
 
void maxHeapify(int i){
  
  int l;
  int r;
  int largest;

  l = left(i);
  r = right(i);
 
  if(l<=n&&A[l]>A[i])largest=l;
  else largest=i;
 
  if(r<=n&&A[r]>A[largest])largest=r;
 
  if(largest!=i){
    exchange(&[i],&A[largest]);
    maxHeapify(largest);
  }
 
}
 

Compiler output:
main.c: In function 'main':
main.c:18:4: error: implicit declaration of function 'maxHeapify' [-Wimplicit-function-declaration]
   18 |    maxHeapify(i);
      |    ^~~~~~~~~~
main.c: At top level:
main.c:42:6: warning: conflicting types for 'maxHeapify'; have 'void(int)'
   42 | void maxHeapify(int i){
      |      ^~~~~~~~~~
main.c:18:4: note: previous implicit declaration of 'maxHeapify' with type 'void(int)'
   18 |    maxHeapify(i);
      |    ^~~~~~~~~~
main.c: In function 'maxHeapify':
main.c:57:15: error: expected expression before '[' token
   57 |     exchange(&[i],&A[largest]);
      |               ^
Language: C

#include<stdio.h>
#define NIL 500003
 
int A[500001],n;
 
int main(){
  int i;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
   scanf("%d",&A[i]);
  }
  
  for(i=n+1;i<500001;i++){
  A[i] = NIL;
  }
  for(i=n/2;i>=1;i--){
  
   maxHeapify(i);
  }
  for(i=1;i<=n;i++)
    {
  printf(" %d",A[i]);
    }  
printf("\n");

return 0;
  
}

int left(int i){
return i*2;
}

int right(int i){
return i*2+1;
}

void exchange(int *a,int *b){
  int tmp=*a;
  *a=*b;
  *b=tmp;
}
 
void maxHeapify(int i){
  
  int l;
  int r;
  int largest;

  l = left(i);
  r = right(i);
 
  if(l<=n&&A[l]>A[i])largest=l;
  else largest=i;
 
  if(r<=n&&A[r]>A[largest])largest=r;
 
  if(largest!=i){
    exchange(&[i],&A[largest]);
    maxHeapify(largest);
  }
 
}
 

Compiler output:
main.c: In function 'main':
main.c:18:4: error: implicit declaration of function 'maxHeapify' [-Wimplicit-function-declaration]
   18 |    maxHeapify(i);
      |    ^~~~~~~~~~
main.c: At top level:
main.c:44:6: warning: conflicting types for 'maxHeapify'; have 'void(int)'
   44 | void maxHeapify(int i){
      |      ^~~~~~~~~~
main.c:18:4: note: previous implicit declaration of 'maxHeapify' with type 'void(int)'
   18 |    maxHeapify(i);
      |    ^~~~~~~~~~
main.c: In function 'maxHeapify':
main.c:59:15: error: expected expression before '[' token
   59 |     exchange(&[i],&A[largest]);
      |               ^
Language: C

#include<stdio.h>
#define MAX 50000
#define NIL 0

/*木*/
int Tree[MAX];

/*プロトタイプ宣言*/
void buildMaxHeap(void);
void maxHeapify(int);

/*グローバル変数*/
int heap_size = 0;


main() {
  int i;//counter

  scanf("%d", &heap_size);

  for(i = 1; i <= heap_size; i++) {
    scanf("%d", &Tree[i]);
  }

  buildMaxHeap();

  for(i = 1; i <= heap_size; i++) {
    printf(" %d", Tree[i]);
  }
  printf("\n");

  return 0;
}


/*
 *    buildMaxHeap関数...iの値を変化させ、ボトムアップで適用させることでmax-heap変換に繋げる
 */
void buildMaxHeap() {
  int i;//counter

  //始めにheap_sizeを2で割る事で構造体ではなく配列でmax-heapを適用させることができる。
  for(i = (heap_size/2); i >= 1; i--) {

    maxHeapifly(i);
  }

}



/*
 *    maxHeapify関数...max-heapを行う関数。コメントは随時記載。
 */
void maxHeapify(int u) {

  int left;
  int right;
  int largest;
  int tmp=0;//保存用関数

  //右と左の仕分け。
  left = 2*u;
  right = 2*u +1;

  //左の値が制限内かつ、元々の数より大きければ最大の値として保存する。...1
  if(left <= heap_size && Tree[left] > Tree[u]) {
    largest = right;
  }

  /**/
  else {
    largest = u;
  }

  //1と同じ要領。順番は左→右なのでここで比較するのは右の値。
  if(right <= heap_size && Tree[right] > Tree[largest]) {
    largest = right;
  }

  /**/
  if(largest != u) {
    tmp = Tree[u];
    Tree[u] = Tree[largest];
    Tree[largest] = tmp;

    //buildMaxHeap関数が終わるまで続ける（再起？）
    maxHeapify(largest);
  }

}

Compiler output:
main.c:16:1: error: return type defaults to 'int' [-Wimplicit-int]
   16 | main() {
      | ^~~~
main.c: In function 'buildMaxHeap':
main.c:45:5: error: implicit declaration of function 'maxHeapifly'; did you mean 'maxHeapify'? [-Wimplicit-function-declaration]
   45 |     maxHeapifly(i);
      |     ^~~~~~~~~~~
      |     maxHeapify
Language: C

#include <stdio.h>
#define MAX 250


int A[MAX];
int heapsize;


void maxheapify(int heap[],int j){
  int largest,leftH,rightH;
    int tmp;
 

    leftH = left(j);


    rightH = right(j);
  if(leftH<=heapsize && heap[left] >heap[j]){
    largest=leftN;
  }

  else {
    largest=i;
  }

  if(rightH<=heapsize && heap[rightH] > heap[largest]){
   
 largest=rightH;

  }
  if(largest != j){

    tmp=heap[largest];

    heap[largest]=heap[j];


    heap[j]=tmp;
    maxheapify(heap,largest);
  }
}
 




void Buildmaxheap(int heap[]){

  int j,i;

  i=heapsize/2;
  for(j=i;j >= 1;j--){
    maxheapify(heap,j);
  }


}




int Left(int i){

  return 2*i;
}

int Right(int i){

  return 2*i+1;
}

main(){

  int i;


  scanf("%d",&heap_size);

  for(i=1;i <= heap_size;i++){

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

  }

  Buildmaxheap(A);

  for(i=1;i <= heap_size;i++){

    
    printf("\n");

  }  
      printf("\n");
  
  return 0;
}

Compiler output:
main.c: In function 'maxheapify':
main.c:14:13: error: implicit declaration of function 'left' [-Wimplicit-function-declaration]
   14 |     leftH = left(j);
      |             ^~~~
main.c:17:14: error: implicit declaration of function 'right' [-Wimplicit-function-declaration]
   17 |     rightH = right(j);
      |              ^~~~~
main.c:18:29: error: array subscript is not an integer
   18 |   if(leftH<=heapsize && heap[left] >heap[j]){
      |                             ^
main.c:19:13: error: 'leftN' undeclared (first use in this function); did you mean 'leftH'?
   19 |     largest=leftN;
      |             ^~~~~
      |             leftH
main.c:19:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:23:13: error: 'i' undeclared (first use in this function)
   23 |     largest=i;
      |             ^
main.c: At top level:
main.c:72:1: error: return type defaults to 'int' [-Wimplicit-int]
   72 | main(){
      | ^~~~
main.c: In function 'main':
main.c:77:15: error: 'heap_size' undeclared (first use in this function); did you mean 'heapsize'?
   77 |   scanf("%d",&heap_size);
      |               ^~~~~~~~~
      |               heapsize
Language: C

#include<stdio.h>
#define MAX 500000
int hsize;
int heap[MAX];//
void maxheap(int);
void make();
int main(){
  int i,l,r;
  scanf("%d",&hsize);
  for(i=1; i <= hsize; i++)//1 から hsizeまで
    scanf("%d",&heap[i]);
  make();
  for(i=1;i<=hsize; i++)//1 から hsizeまで
    printf(" %d",heap[i]);
  //if(i !=1)printf(" 
  // printf("%d",heap[i]);
  printf("\n");
  return 0;
}

void maxheap(int j){
  int len;
  int l = left(j),r= right(j),m;
  if(l <= hsize  && heap[l] < heap[l])
    len =l;
  else
    len = j;
  if(r <= hsize && heap[r] > heap[len])
    len = r;
  if(len != j){
    m=heap[j];
    heap[j] = heap[len];
    heap[len]=m;
    maxheap(len);
  }
}
int make(){
  int i;
  for(i =(hsize/2); i>= 1; i --){
    maxheap(i);
  }
}int parent(int i){
  int x= i/2;
  return x;
}

int left(int i){
  int x = 2*i;
  return x;
}

int right(int i){
  int x = (2*i)+1;
  return x;
}

Compiler output:
main.c: In function 'maxheap':
main.c:23:11: error: implicit declaration of function 'left' [-Wimplicit-function-declaration]
   23 |   int l = left(j),r= right(j),m;
      |           ^~~~
main.c:23:22: error: implicit declaration of function 'right' [-Wimplicit-function-declaration]
   23 |   int l = left(j),r= right(j),m;
      |                      ^~~~~
main.c: At top level:
main.c:37:5: error: conflicting types for 'make'; have 'int()'
   37 | int make(){
      |     ^~~~
main.c:6:6: note: previous declaration of 'make' with type 'void()'
    6 | void make();
      |      ^~~~