Language: C

#include<stdio.h>
#define MAX 100;
#define INFTY 10000000;
#define WHITE 0;
#define GRAY 1;
#define BLAK 2;
int n,M[MAX][MAX];

int prim(){
  int u,minv,i,v,sum=0;
  int d[MAX],p[MAX],color[MAX];
  for(i=0;i<n;i++){
    d[i]=INFTY;
    p[i]=-1;
    color[i]=WHITE;
  }
  d[0]=0;
  while(1){
    minv=INFTY;
    u=-1;
    for(i=0;i<n;i++){
      if(minv>d[i]&&color[i]!=BLACK){
	u=i;
	minv=d[i];
      }
    }
    if(u==-1){
      break;
    }
    color[u]=BLACK;
    for(v=0;v<n;v++){
      if(color[v]!=BLACK && M[u][v] != INFTY){
	if(d[v] >M[u][v]){
	  d[v]=M[u][v];
	  p[v]=u;
	  color[v]=GRAY;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    if(p[i]!=-1){
      sum+=M[i][p[i]];
    }
  }
  return sum;
}

int main(){
  int i,j,e;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&e);
      M[i][j]=(e==-1)?INFTY : e;
    }
  }
  printf("%d \n",prim());
  return 0;
}

Compiler output:
main.c:2:16: error: expected ']' before ';' token
    2 | #define MAX 100;
      |                ^
main.c:7:9: note: in expansion of macro 'MAX'
    7 | int n,M[MAX][MAX];
      |         ^~~
main.c:7:17: error: expected identifier or '(' before ']' token
    7 | int n,M[MAX][MAX];
      |                 ^
main.c: In function 'prim':
main.c:2:16: error: expected ']' before ';' token
    2 | #define MAX 100;
      |                ^
main.c:11:9: note: in expansion of macro 'MAX'
   11 |   int d[MAX],p[MAX],color[MAX];
      |         ^~~
main.c:11:19: error: expected statement before ']' token
   11 |   int d[MAX],p[MAX],color[MAX];
      |                   ^
main.c:11:20: error: expected expression before ',' token
   11 |   int d[MAX],p[MAX],color[MAX];
      |                    ^
main.c:11:21: error: 'color' undeclared (first use in this function)
   11 |   int d[MAX],p[MAX],color[MAX];
      |                     ^~~~~
main.c:11:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:5: error: 'd' undeclared (first use in this function)
   13 |     d[i]=INFTY;
      |     ^
main.c:14:5: error: 'p' undeclared (first use in this function)
   14 |     p[i]=-1;
      |     ^
main.c:22:31: error: 'BLACK' undeclared (first use in this function); did you mean 'BLAK'?
   22 |       if(minv>d[i]&&color[i]!=BLACK){
      |                               ^~~~~
      |                               BLAK
main.c:32:29: error: 'M' undeclared (first use in this function)
   32 |       if(color[v]!=BLACK && M[u][v] != INFTY){
      |                             ^
main.c:3:23: error: expected ')' before ';' token
    3 | #define INFTY 10000000;
      |                       ^
main.c:32:40: note: in expansion of macro 'INFTY'
   32 |       if(color[v]!=BLACK && M[u][v] != INFTY){
      |                                        ^~~~~
main.c:32:9: note: to match this '('
   32 |       if(color[v]!=BLACK && M[u][v] != INFTY){
      |         ^
main.c: In function 'main':
main.c:55:7: error: 'M' undeclared (first use in this function)
   55 |       M[i][j]=(e==-1)?INFTY : e;
      |       ^
main.c:3:23: error: expected ':' before ';' token
    3 | #define INFTY 10000000;
      |                       ^
main.c:55:23: note: in expansion of macro 'INFTY'
   55 |       M[i][j]=(e==-1)?INFTY : e;
      |                       ^~~~~
main.c:55:29: error: expected expression before ':' token
   55 |       M[i][j]=(e==-1)?INFTY : e;
      |                             ^