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

#include <stdio.h>
#define MAX 500000

int n, A[MAX];

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

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

void maxHeapify(int A[], int i){

  int temp, largest, l, r;

   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){
     temp = A[i];
     A[i] = A[largest];
     A[largest] = temp;
    
     maxHeapify(A, largest);
   }
}

void buildMaxHeap(int A[]){

  int i;
  for(i=n/2;i!=0;i--){
      maxHeapify(A,i);
  }
}


main(){

  int j,k;

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

   buildMaxHeap(A);

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

Compiler output:
main.c:49:1: error: return type defaults to 'int' [-Wimplicit-int]
   49 | main(){
      | ^~~~
main.c: In function 'main':
main.c:65:3: error: expected declaration or statement at end of input
   65 |   return 0;
      |   ^~~~~~
Language: C

#Include<stdio.h>
#define N 500000

void maxHeapify(int);
int parent(int);
int left(int);
int right(int);


int  T[N];

  int h_size;

int main(){
  int i;

  scanf("%d",&h_size);
  for(i=0;i<h_size;i++){
    scanf("%d",&T[i]);
  maxHeapify(i);
  }

  for(i=0 ; i<h_size ; i++){
    printf(" %d",T[i]);
  }
  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 maxHeapify(int i){
  int l,r,largest,save;
  l=left(i);
  r=right(i);
  if(1<= h_size && T[l]>T[i]) largest=l;
  else largest=i;
  if(r<=h_size && T[r]>T[largest]) largest = r;
  if(largest !=i){
    save=T[i];
    T[i]=T[largest];
    T[largest]=save;
    maxHeaapify(largest);
  }
}

Compiler output:
main.c:1:2: error: invalid preprocessing directive #Include; did you mean #include?
    1 | #Include<stdio.h>
      |  ^~~~~~~
      |  include
main.c: In function 'main':
main.c:17:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   17 |   scanf("%d",&h_size);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #Include<stdio.h>
main.c:17:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   17 |   scanf("%d",&h_size);
      |   ^~~~~
main.c:17:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:24:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   24 |     printf(" %d",T[i]);
      |     ^~~~~~
main.c:24:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:24:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:24:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'maxHeapify':
main.c:52:5: error: implicit declaration of function 'maxHeaapify'; did you mean 'maxHeapify'? [-Wimplicit-function-declaration]
   52 |     maxHeaapify(largest);
      |     ^~~~~~~~~~~
      |     maxHeapify
Language: C

include<stdio.h>
#define N 100000
int n;

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

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

void maxHeapify(int T[],int i){
  int l,r,largest,key;

  l=Left(i);
  r=Right(i);

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

  if(r<=n&&T[r]>T[largest]) largest=r;

  if(largest!=i){
    key=T[i];
    T[i]=T[largest];
    T[largest]=key;
    maxHeapify(T,largest);
  }

}

void buildMaxHeap(int T[]){
  int i;

  for(i=n/2;i>=1;i--){
    maxHeapify(T,i);
  }
  
}

int main(void){
  int i,T[N];

  scanf("%d",&n);

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

  buildMaxHeap(T);

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

  printf("\n");
  return 0;

}

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
main.c: In function 'maxHeapify':
main.c:19:9: error: 'n' undeclared (first use in this function)
   19 |   if(l<=n&&T[l]>T[i]) largest=l;
      |         ^
main.c:19:9: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'buildMaxHeap':
main.c:36:9: error: 'n' undeclared (first use in this function)
   36 |   for(i=n/2;i>=1;i--){
      |         ^
main.c: In function 'main':
main.c:45:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   45 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include<stdio.h>
main.c:45:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   45 |   scanf("%d",&n);
      |   ^~~~~
main.c:45:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:45:15: error: 'n' undeclared (first use in this function)
   45 |   scanf("%d",&n);
      |               ^
main.c:54:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   54 |     printf(" %d",T[i]);
      |     ^~~~~~
main.c:54:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:54:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:54:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:57:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   57 |   printf("\n");
      |   ^~~~~~
main.c:57:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C


#include<stdio.h>
#difene H 5000000

int A[H],n;

void maxHeapify( int *A ,int  i ){

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


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


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

Compiler output:
main.c:3:2: error: invalid preprocessing directive #difene; did you mean #define?
    3 | #difene H 5000000
      |  ^~~~~~
      |  define
main.c:5:7: error: 'H' undeclared here (not in a function)
    5 | int A[H],n;
      |       ^
main.c: In function 'maxHeapify':
main.c:26:17: error: passing argument 1 of 'maxHeapify' makes pointer from integer without a cast [-Wint-conversion]
   26 |     maxHeapify( largest );
      |                 ^~~~~~~
      |                 |
      |                 int
main.c:7:23: note: expected 'int *' but argument is of type 'int'
    7 | void maxHeapify( int *A ,int  i ){
      |                  ~~~~~^
main.c:26:5: error: too few arguments to function 'maxHeapify'
   26 |     maxHeapify( largest );
      |     ^~~~~~~~~~
main.c:7:6: note: declared here
    7 | void maxHeapify( int *A ,int  i ){
      |      ^~~~~~~~~~
main.c: At top level:
main.c:42:1: error: return type defaults to 'int' [-Wimplicit-int]
   42 | main(){
      | ^~~~
Language: C

    largest = i;
      
  if (r <= n && A[r] > A[largest])
    largest = r;
  
  if (largest != i){
    a = A[i];
    A[i] = A[largest];
    A[i] = a;
    maxHeapify( A , largest );
  
  }	 
}


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


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

Compiler output:
main.c:1:5: warning: data definition has no type or storage class
    1 |     largest = i;
      |     ^~~~~~~
main.c:1:5: error: type defaults to 'int' in declaration of 'largest' [-Wimplicit-int]
main.c:1:15: error: 'i' undeclared here (not in a function)
    1 |     largest = i;
      |               ^
main.c:3:3: error: expected identifier or '(' before 'if'
    3 |   if (r <= n && A[r] > A[largest])
      |   ^~
main.c:6:3: error: expected identifier or '(' before 'if'
    6 |   if (largest != i){
      |   ^~
main.c:13:1: error: expected identifier or '(' before '}' token
   13 | }
      | ^
main.c: In function 'buildMaxHeap':
main.c:20:11: error: 'n' undeclared (first use in this function)
   20 |   for(i = n / 2; i > 0 ; i--)
      |           ^
main.c:20:11: note: each undeclared identifier is reported only once for each function it appears in
main.c:21:5: error: implicit declaration of function 'maxHeapify' [-Wimplicit-function-declaration]
   21 |     maxHeapify( A , i );
      |     ^~~~~~~~~~
main.c: At top level:
main.c:26:1: error: return type defaults to 'int' [-Wimplicit-int]
   26 | main(){
      | ^~~~
main.c: In function 'main':
main.c:30:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   30 |   scanf("%d", &n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 |     largest = i;
main.c:30:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   30 |   scanf("%d", &n);
      |   ^~~~~
main.c:30:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:30:16: error: 'n' undeclared (first use in this function)
   30 |   scanf("%d", &n);
      |                ^
main.c:33:18: error: 'A' undeclared (first use in this function)
   33 |     scanf("%d", &A[i]);
      |                  ^
main.c:38:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   38 |     printf(" %d", A[i]);
      |     ^~~~~~
main.c:38:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:38:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:38:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:40:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   40 |   printf("\n");
      |   ^~~~~~
main.c:40:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include<stdio.h>
#define H 5000000

int A[H],n;

void maxHeapify( int *A ,int  i ){

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


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


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

Compiler output:
main.c:41:1: error: return type defaults to 'int' [-Wimplicit-int]
   41 | main(){
      | ^~~~
main.c: In function 'main':
main.c:50:3: error: implicit declaration of function 'buildMaxHeap' [-Wimplicit-function-declaration]
   50 |   buildMaxHeap(A);
      |   ^~~~~~~~~~~~
Language: C

#include <stdio.h>

#define H 500000

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

int Heap[H], n;

int main(){
  int i;

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

  for(i = n/2; i > 0; i--){
    maxHeapify(i);
  }

  for(i = 1; i <= n; i++)
    printf(" %d", Heap[i]);

  printf("\n");

  return 0;
}

void(int* a, int* b){
  int tmp;
  tmp = *a;
  *a = *b;
  *b = tmp;
}
void maxHeapify(int i){
  int left, right, max, reserve;

  left = i*2;
  right = i*2+1;
  if(left <= n && Heap[left] > Heap[i])
    max = left;
  else
    max = i;

  if(right <= n && Heap[right] > Heap[i])
    max = right;

  if(max != i){
    swap(&Heap[i], &Heap[max]);
    maxHeapify(max);
  }
}

Compiler output:
main.c:29:6: error: expected identifier or '(' before 'int'
   29 | void(int* a, int* b){
      |      ^~~
Language: C

#include<stdio.h>

#define H 250

int A[H],size;

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

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

void maxHeapify(int B[],int i){
  int l = left(i);
  int r = right(i);
  int tmp,largest;
  // ????????????????????????????????§???????????§????????????????????¶
  if(l<=H && B[l]>B[i]) largest = l;
  else largest = i;
  if(r<=H && B[r]>B[largest]) largest = r;

  if(largest != i){ // i ???????????????????????§????????´???
      tmp = B[i];
    B[i] = B[largest];
    B[largest] = tmp;
    maxHeapify(B, largest); // ?????°??????????????????
      }
}
void  buildMaxHeap(int B[]){
  for(int i=size/2;i>=1;i--){
    maxHeapify(B, i);
      }
}


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

  buildMaxHeap(A);

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

  return 0;
}

Compiler output:
main.c: In function 'left':
main.c:7:5: error: type of 'i' defaults to 'int' [-Wimplicit-int]
    7 | int left(i){
      |     ^~~~
main.c: In function 'right':
main.c:11:5: error: type of 'i' defaults to 'int' [-Wimplicit-int]
   11 | int right(i){
      |     ^~~~~
Language: C

#include<stdio.h>

#define H 250

int A[H],size;

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

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

void maxHeapify(int B[],int i){
  int l = left(i);
  int r = right(i);
  int tmp,largest;
  if(l<=H && B[l]>B[i]) largest = l;
  else largest = i;
  if(r<=H && B[r]>B[largest]) largest = r;

  if(largest != i){
      tmp = B[i];
    B[i] = B[largest];
    B[largest] = tmp;
    maxHeapify(B, largest);
      }
}
void  buildMaxHeap(int B[]){
  for(int i=size/2;i>=1;i--){
    maxHeapify(B, i);
      }
}


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

  buildMaxHeap(A);

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

  return 0;
}

Compiler output:
main.c: In function 'left':
main.c:7:5: error: type of 'i' defaults to 'int' [-Wimplicit-int]
    7 | int left(i){
      |     ^~~~
main.c: In function 'right':
main.c:11:5: error: type of 'i' defaults to 'int' [-Wimplicit-int]
   11 | int right(i){
      |     ^~~~~
Language: C

#include<stdio.h>
#define MAX 2000000

int n, A[MAX+1];

void maximumsHeap(int i){
int l,r,largest;
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=l;
}

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

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

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

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

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

Compiler output:
main.c: In function 'maximumsHeap':
main.c:22:1: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   22 | swap(A[i],A[largest]);
      | ^~~~
main.c:23:1: error: implicit declaration of function 'maximumHeap'; did you mean 'maximumsHeap'? [-Wimplicit-function-declaration]
   23 | maximumHeap(largest);
      | ^~~~~~~~~~~
      | maximumsHeap
main.c: In function 'main':
main.c:30:5: error: 'i' undeclared (first use in this function)
   30 | for(i=1;i<=i;i++){
      |     ^
main.c:30:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#define MAX 2000000

int n, A[MAX+1];

void maximumsHeap(int i){
int l,r,largest;
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=l;
}

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

int main(void){

int i;

scanf("%d",&n);

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

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

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

Compiler output:
main.c: In function 'maximumsHeap':
main.c:22:1: error: implicit declaration of function 'swap' [-Wimplicit-function-declaration]
   22 | swap(A[i],A[largest]);
      | ^~~~
main.c:23:1: error: implicit declaration of function 'maximumHeap'; did you mean 'maximumsHeap'? [-Wimplicit-function-declaration]
   23 | maximumHeap(largest);
      | ^~~~~~~~~~~
      | maximumsHeap
Language: C


#include<stdio.h>
#define MAX 2000000

int n, A[MAX+1];

void maximumsHeap(int i){
int l,r,largest;
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=l;
}

if(largest != i){
int k;
k=A[i];
A[i]=A[largest];
A[largest]=k;
maximumHeap(largest);
}
}

int main(void){

int i;

scanf("%d",&n);

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

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

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

Compiler output:
main.c: In function 'maximumsHeap':
main.c:27:1: error: implicit declaration of function 'maximumHeap'; did you mean 'maximumsHeap'? [-Wimplicit-function-declaration]
   27 | maximumHeap(largest);
      | ^~~~~~~~~~~
      | maximumsHeap
Language: C


#include<stdio.h>
#define MAX 2000000

int n, A[MAX+1];

void maximumHeap(int);

void maximumsHeap(int i){
int l,r,largest;
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=l;
}

if(largest != i){
int k;
k=A[i];
A[i]=A[largest];
A[largest]=k;
maximumHeap(largest);
}
}

int main(void){

int i;

scanf("%d",&n);

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

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

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

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


#include<stdio.h>
#define MAX 2000000

int n, A[MAX+1];

int maximumHeap(int);

void maximumsHeap(int i){
int l,r,largest;
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=l;
}

if(largest != i){
int k;
k=A[i];
A[i]=A[largest];
A[largest]=k;
maximumHeap(largest);
}
}

int main(void){

int i;

scanf("%d",&n);

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

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

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

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


#include<stdio.h>
#define MAX 2000000

int n, A[MAX+1];



int maximumsHeap(int i){
int l,r,largest;
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=l;
}

if(largest != i){
int k;
k=A[i];
A[i]=A[largest];
A[largest]=k;
maximumHeap(largest);
}
}

int main(void){

int i;

scanf("%d",&n);

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

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

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

Compiler output:
main.c: In function 'maximumsHeap':
main.c:29:1: error: implicit declaration of function 'maximumHeap'; did you mean 'maximumsHeap'? [-Wimplicit-function-declaration]
   29 | maximumHeap(largest);
      | ^~~~~~~~~~~
      | maximumsHeap
Language: C


#include<stdio.h>
#define MAX 2000000

int n, A[MAX+1];


void maximumsHeap(int i){
int l,r,largest;
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=l;
}

if(largest != i){
int k;
k=A[i];
A[i]=A[largest];
A[largest]=k;
maximumHeap(largest);
}
}

int main(void){

int i;

scanf("%d",&n);

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

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

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

Compiler output:
main.c: In function 'maximumsHeap':
main.c:28:1: error: implicit declaration of function 'maximumHeap'; did you mean 'maximumsHeap'? [-Wimplicit-function-declaration]
   28 | maximumHeap(largest);
      | ^~~~~~~~~~~
      | maximumsHeap
Language: C


#include<stdio.h>
#define MAX 2000000

int n, A[MAX+1];


void maximumsHeap(int i){
int l,r,largest;
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=l;
}

if(largest != i){
int k;
k=A[i];
A[i]=A[largest];
A[largest]=k;
maximumHeap(largest);
}
}

int main(){

int i;

scanf("%d",&n);

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

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

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

Compiler output:
main.c: In function 'maximumsHeap':
main.c:28:1: error: implicit declaration of function 'maximumHeap'; did you mean 'maximumsHeap'? [-Wimplicit-function-declaration]
   28 | maximumHeap(largest);
      | ^~~~~~~~~~~
      | maximumsHeap
Language: C

#include<iostream>
using namespace std;
#define MAX 2000000

int n, A[MAX+1];

void maximumHeap(int i){
int l,r,largest;
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=l;
}

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

int main(void){

int i;

scanf("%d",&n);

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

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

for(i=1;i<=n;i++){
printf(" %d",A[i]);
}
printf("\n");
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>
#define MAX 2000000


int maximumsHeap(int i){
int n,A[MAX+1],l,r,largest;
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=l;
}

if(largest != i){
int k;
k=A[i];
A[i]=A[largest];
A[largest]=k;
maximumHeap(largest);
}
return 0;
}

int main(void){

int i,n,A[MAX+1];

scanf("%d",&n);

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

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

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

Compiler output:
main.c: In function 'maximumsHeap':
main.c:25:1: error: implicit declaration of function 'maximumHeap'; did you mean 'maximumsHeap'? [-Wimplicit-function-declaration]
   25 | maximumHeap(largest);
      | ^~~~~~~~~~~
      | maximumsHeap
Language: C

#include<iosteam>
#define MAX 2000000


int maximumHeap(int i){
int n,A[MAX+1],l,r,largest;
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=l;
}

if(largest != i){
swap(A[i],A[largest];
maximumHeap(largest);
}
return 0;
}

int main(void){

int i,n,A[MAX+1];

scanf("%d",&n);

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

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

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

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

#include<iostream>
#define MAX 2000000


int maximumHeap(int i){
int n,A[MAX+1],l,r,largest;
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=l;
}

if(largest != i){
swap(A[i],A[largest];
maximumHeap(largest);
}
return 0;
}

int main(void){

int i,n,A[MAX+1];

scanf("%d",&n);

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

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

for(i=1;i<=n;i++){
printf(" %d",A[i]);
}
printf("\n");
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>
#define MAX 500000
 
int T[MAX]; 
int n;

void maxHeapify(int);
void buildMaxHeap();
int parent(int);
int left(int);
int right(int);
 
int main()
{
  int i;
  
  scanf("%d", &n); 
  for(i=1; i<=n; i++){
    scanf("%d", &T[i]);
  }
  
  buildMaxHeap();
 
  for(i=1; i<=n; i++){   
    printf(" %d", T[i]);
  }
 
  printf("\n");
 
  return 0;
}


void buildMaxHeap()
{
  int i;

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


void maxHeapify(int i)
{
  int largest, exchange, getl, getr;

  getl = getLeft(i);
  getr = getRight(i);
  
  if((n >= getl) && (T[getl] > T[i])){
	largest = getl;
  }
  else{
	largest = i;
  }
   
  if((n >= getr) && (T[getr] > T[largest])){
	largest = getr;
  }

  if (largest != i){
    exchange = T[i];
    T[i] = T[largest];
    T[largest] = exchange;
    maxHeapify(largest);
  } 

}


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

Compiler output:
main.c: In function 'maxHeapify':
main.c:48:10: error: implicit declaration of function 'getLeft' [-Wimplicit-function-declaration]
   48 |   getl = getLeft(i);
      |          ^~~~~~~
main.c:49:10: error: implicit declaration of function 'getRight' [-Wimplicit-function-declaration]
   49 |   getr = getRight(i);
      |          ^~~~~~~~
Language: C

#include <stdio.h>
 
  
void maxH(int *node, int i, int g){
  int large, s;
   
  l = i*2;
  r = i*2+1;
     
  if(i*2 <= g && node[i*2] > node[i]) large = i*2;
  else large = i;
  if(i*2+1 <= g && node[I*2+1] > node[large])large = i*2+1;
  
  if(large != i){
    s = node[i];
    node[i] = node[large];
    node[large] = s;
    maxH(node, large, g);
  }
}
  
main(){
  int i, g;
  int node[500001];
  
  scanf("%d", &g);
  
  for(i=1;i<=g;i++) scanf("%d", &node[i]);
  
  for(i =g/2;i>0;i--) maxH(node,i,g);
  
  
  for(i=1;i<=g;i++) printf(" %d",node[i]);
  
  printf("\n");
  return 0; 
}

Compiler output:
main.c: In function 'maxH':
main.c:7:3: error: 'l' undeclared (first use in this function)
    7 |   l = i*2;
      |   ^
main.c:7:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:3: error: 'r' undeclared (first use in this function)
    8 |   r = i*2+1;
      |   ^
main.c:12:25: error: 'I' undeclared (first use in this function)
   12 |   if(i*2+1 <= g && node[I*2+1] > node[large])large = i*2+1;
      |                         ^
main.c: At top level:
main.c:22:1: error: return type defaults to 'int' [-Wimplicit-int]
   22 | main(){
      | ^~~~
Language: C

#include <stdio.h>

int n;

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

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

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

int main(){
  int i,node[250];

  scanf("%d",&n);

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

  buildMaxHeap(node);

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

  return 0;
}
   

Compiler output:
main.c: In function 'main':
main.c:49:17: error: expected ')' before 'node'
   49 |   printf(" %d\n"node[n]);
      |         ~       ^~~~
      |                 )
Language: C

int right(int);
int key[H];
int i;
int main(){
  int n;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&key[i]);
}
  buildMaxHeap();
 for(i=1;i<=n;i++){
    printf(" %d",key[i]);
 }
 printf(" \n");
 return 0;
}
  void maxHeapify(int i){
    int L,R,temp;
    int largest=0;
    L=left(i);
    R=right(i);
    if(L<=H && key[L]>key[i]) largest=L;
    else largest=i;
    if(R<=H && key[R]>key[largest]) largest=R;
       if(largest!=i){
	 temp=key[i];
	 key[i]=key[largest];
	 key[largest]=temp;
	 maxHeapify(largest);
       }
  }
void buildMaxHeap(void){
  for(i=H/2;i>=1;i--){
    maxHeapify(i);
  }
}
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i+1;
}

Compiler output:
main.c:2:9: error: 'H' undeclared here (not in a function)
    2 | int key[H];
      |         ^
main.c: In function 'main':
main.c:6:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    6 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int right(int);
main.c:6:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    6 |   scanf("%d",&n);
      |   ^~~~~
main.c:6:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:10:3: error: implicit declaration of function 'buildMaxHeap' [-Wimplicit-function-declaration]
   10 |   buildMaxHeap();
      |   ^~~~~~~~~~~~
main.c:12:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   12 |     printf(" %d",key[i]);
      |     ^~~~~~
main.c:12:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:12:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:12:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:14:2: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   14 |  printf(" \n");
      |  ^~~~~~
main.c:14:2: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'maxHeapify':
main.c:20:7: error: implicit declaration of function 'left' [-Wimplicit-function-declaration]
   20 |     L=left(i);
      |       ^~~~
main.c: At top level:
main.c:32:6: warning: conflicting types for 'buildMaxHeap'; have 'void(void)'
   32 | void buildMaxHeap(void){
      |      ^~~~~~~~~~~~
main.c:10:3: note: previous implicit declaration of 'buildMaxHeap' with type 'void(void)'
   10 |   buildMaxHeap();
      |   ^~~~~~~~~~~~
Language: C

int right(int);
int key[H];
int i;
int main(){
  int n;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&key[i]);
}
  buildMaxHeap();
 for(i=1;i<=n;i++){
    printf(" %d",key[i]);
 }
 printf("\n");
 return 0;
}
  void maxHeapify(int i){
    int L,R,temp;
    int largest=0;
    L=left(i);
    R=right(i);
    if(L<=H && key[L]>key[i]) largest=L;
    else largest=i;
    if(R<=H && key[R]>key[largest]) largest=R;
       if(largest!=i){
	 temp=key[i];
	 key[i]=key[largest];
	 key[largest]=temp;
	 maxHeapify(largest);
       }
  }
void buildMaxHeap(void){
  for(i=H/2;i>=1;i--){
    maxHeapify(i);
  }
}
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i+1;
}

Compiler output:
main.c:2:9: error: 'H' undeclared here (not in a function)
    2 | int key[H];
      |         ^
main.c: In function 'main':
main.c:6:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    6 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int right(int);
main.c:6:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    6 |   scanf("%d",&n);
      |   ^~~~~
main.c:6:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:10:3: error: implicit declaration of function 'buildMaxHeap' [-Wimplicit-function-declaration]
   10 |   buildMaxHeap();
      |   ^~~~~~~~~~~~
main.c:12:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   12 |     printf(" %d",key[i]);
      |     ^~~~~~
main.c:12:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:12:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:12:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:14:2: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   14 |  printf("\n");
      |  ^~~~~~
main.c:14:2: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: In function 'maxHeapify':
main.c:20:7: error: implicit declaration of function 'left' [-Wimplicit-function-declaration]
   20 |     L=left(i);
      |       ^~~~
main.c: At top level:
main.c:32:6: warning: conflicting types for 'buildMaxHeap'; have 'void(void)'
   32 | void buildMaxHeap(void){
      |      ^~~~~~~~~~~~
main.c:10:3: note: previous implicit declaration of 'buildMaxHeap' with type 'void(void)'
   10 |   buildMaxHeap();
      |   ^~~~~~~~~~~~
Language: C

include<stdio.h>
#define N 500000
 
int n,A[N];
 
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 c;
  int l = 2 * i;
  int r = 2 * i + 1;
  int max=0;
  if(l <= b && a[l] > a[i]){
    max = l;
  }
  else {
    max = i;
  }
 
  if(r <= b && a[r] > a[max]){
    max = r;
  }
 
  if(max != i){
    c = a[i];
    a[i] = a[max];
    a[max] = c;
    maxHeapify(max);
  }
}
 

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
main.c: In function 'main':
main.c:9:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    9 |     scanf("%d",&n);
      |     ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include<stdio.h>
main.c:9:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    9 |     scanf("%d",&n);
      |     ^~~~~
main.c:9:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:9:17: error: 'n' undeclared (first use in this function)
    9 |     scanf("%d",&n);
      |                 ^
main.c:9:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:11:19: error: 'A' undeclared (first use in this function)
   11 |       scanf("%d",&A[i]);
      |                   ^
main.c:14:7: error: implicit declaration of function 'maxHeapify' [-Wimplicit-function-declaration]
   14 |       maxHeapify(i);
      |       ^~~~~~~~~~
main.c:17:7: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   17 |       printf(" %d",A[i]);
      |       ^~~~~~
main.c:17:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:17:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:17:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:19:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   19 |     printf("\n");
      |     ^~~~~~
main.c:19:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:23:6: warning: conflicting types for 'maxHeapify'; have 'void(int)'
   23 | void maxHeapify(int i){
      |      ^~~~~~~~~~
main.c:14:7: note: previous implicit declaration of 'maxHeapify' with type 'void(int)'
   14 |       maxHeapify(i);
      |       ^~~~~~~~~~
main.c: In function 'maxHeapify':
main.c:28:11: error: 'b' undeclared (first use in this function)
   28 |   if(l <= b && a[l] > a[i]){
      |           ^
main.c:28:16: error: 'a' undeclared (first use in this function)
   28 |   if(l <= b && a[l] > a[i]){
      |                ^
Language: C

include<stdio.h>
#define N 500000
 
int n,A[N];
 
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 c;
  int l = 2 * i;
  int r = 2 * i + 1;
  int max=0;
  if(l <= n && A[l] > A[i]){
    max = l;
  }
  else {
    max = i;
  }
 
  if(r <= n && A[r] > A[max]){
    max = r;
  }
 
  if(max != i){
    c = A[i];
    A[i] = A[max];
    A[max] = c;
    maxHeapify(max);
  }
}
 

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
main.c: In function 'main':
main.c:9:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    9 |     scanf("%d",&n);
      |     ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include<stdio.h>
main.c:9:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    9 |     scanf("%d",&n);
      |     ^~~~~
main.c:9:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:9:17: error: 'n' undeclared (first use in this function)
    9 |     scanf("%d",&n);
      |                 ^
main.c:9:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:11:19: error: 'A' undeclared (first use in this function)
   11 |       scanf("%d",&A[i]);
      |                   ^
main.c:14:7: error: implicit declaration of function 'maxHeapify' [-Wimplicit-function-declaration]
   14 |       maxHeapify(i);
      |       ^~~~~~~~~~
main.c:17:7: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   17 |       printf(" %d",A[i]);
      |       ^~~~~~
main.c:17:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:17:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:17:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:19:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   19 |     printf("\n");
      |     ^~~~~~
main.c:19:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:23:6: warning: conflicting types for 'maxHeapify'; have 'void(int)'
   23 | void maxHeapify(int i){
      |      ^~~~~~~~~~
main.c:14:7: note: previous implicit declaration of 'maxHeapify' with type 'void(int)'
   14 |       maxHeapify(i);
      |       ^~~~~~~~~~
main.c: In function 'maxHeapify':
main.c:28:11: error: 'n' undeclared (first use in this function)
   28 |   if(l <= n && A[l] > A[i]){
      |           ^
main.c:28:16: error: 'A' undeclared (first use in this function)
   28 |   if(l <= n && A[l] > A[i]){
      |                ^
Language: C

int left(int);
int right(int);

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

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

void maxHeapify(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;

    maxHeapify(largest);
  }
}

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

  int main()
  {

    scanf("%d",&h);

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

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

    }

  buildMaxHeap();

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

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

   }

 printf("\n");

    return 0;
  }

Compiler output:
main.c: In function 'maxHeapify':
main.c:20:9: error: 'h' undeclared (first use in this function)
   20 |   if(l<=h && A[l]>A[i]) largest=l;
      |         ^
main.c:20:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:14: error: 'A' undeclared (first use in this function)
   20 |   if(l<=h && A[l]>A[i]) largest=l;
      |              ^
main.c: In function 'buildMaxHeap':
main.c:41:9: error: 'i' undeclared (first use in this function)
   41 |     for(i=h/2;i>=1;i--){
      |         ^
main.c:41:11: error: 'h' undeclared (first use in this function)
   41 |     for(i=h/2;i>=1;i--){
      |           ^
main.c: In function 'main':
main.c:49:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   49 |     scanf("%d",&h);
      |     ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int left(int);
main.c:49:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   49 |     scanf("%d",&h);
      |     ^~~~~
main.c:49:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:49:17: error: 'h' undeclared (first use in this function)
   49 |     scanf("%d",&h);
      |                 ^
main.c:51:9: error: 'i' undeclared (first use in this function)
   51 |     for(i=1;i<=h;i++){
      |         ^
main.c:53:19: error: 'A' undeclared (first use in this function)
   53 |       scanf("%d",&A[i]);
      |                   ^
main.c:61:4: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   61 |    printf(" %d",A[i]);
      |    ^~~~~~
main.c:61:4: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:61:4: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:61:4: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:65:2: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   65 |  printf("\n");
      |  ^~~~~~
main.c:65:2: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include <stdio.h>

#define N 10000
#define Nil -1

int n;
void maxheapify(int*, int);
void buildMaxHeap(int*);

void maxheapify(int* A, int i){
  int l,r,largest,tmp;

  l = 2i;
  r = 2i +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(A,largest);
  }
}

void buildMaxHeap(int* A){
  int i;

  for(i = n/2;i>=1;i--)
    maxHeapify(A,i);

}

int main(){
  int i;
  int T[N];

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

  buildMaxHeap(T);

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

  printf("\n");

  return 0;
}

Compiler output:
main.c: In function 'buildMaxHeap':
main.c:31:5: error: implicit declaration of function 'maxHeapify'; did you mean 'maxheapify'? [-Wimplicit-function-declaration]
   31 |     maxHeapify(A,i);
      |     ^~~~~~~~~~
      |     maxheapify
Language: C

int A[N],n;
void maxHeapify(int);
void buildMaxHeap(void);


int main(){

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

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

   buildMaxHeap();

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

    return 0;
  }

  void maxHeapify(int i){

    int left,right,large,tmp;

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

    if(left <= n && (A[left]>A[i]) ){
      large = left;
    }
    else large = i;

    if(right <= n && (A[right]>A[large]) ){
      large = right;
    }

    if(large != i){
      tmp = A[i];
      A[i] = A[large];
      A[large] = tmp;
      maxHeapify(large);
    }
  }

  
void buildMaxHeap(void){

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

Compiler output:
main.c:1:7: error: 'N' undeclared here (not in a function)
    1 | int A[N],n;
      |       ^
main.c: In function 'main':
main.c:9:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    9 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int A[N],n;
main.c:9:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    9 |   scanf("%d",&n);
      |   ^~~~~
main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:18:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   18 |     printf(" %d",A[i]);
      |     ^~~~~~
main.c:18:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:18:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:18:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:20:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   20 |     printf("\n");
      |     ^~~~~~
main.c:20:5: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C


#include<stdio.h>

#define MAX 2000000

int A[MAX + 1],H;
void maxHeapify(int i){

  int r , l , largest;
  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){
    swap(A[i],A[largest]);
    return maxHeapify(largest);
  }
}
int main(){
  int i;
  scanf("%d",&H);
  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");
}

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

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

Compiler output:
main.c: In function 'maxHeapify':
main.c:14:38: error: expected identifier or '(' before 'int'
   14 |   int l = getleft(i),r = getright(i),int largest,j;
      |                                      ^~~
main.c:15:30: error: 'largest' undeclared (first use in this function)
   15 |   if( l <= h && A[l] > A[i]) largest = l;
      |                              ^~~~~~~
main.c:15:30: note: each undeclared identifier is reported only once for each function it appears in
main.c:19:5: error: 'j' undeclared (first use in this function)
   19 |     j=A[i];
      |     ^