Language: C

#include<stdio.h>
#include<string.h>

#define L 100000
int V,E;
int color=0;

typedef struct list{
  int id;
  struct list *next;
}list;


list * makelist(int x){
  list *new = malloc(sizeof(list));
  new->id = x;
  new->next = NULL;
  return new;
}

void list_insert(list* L[], int x, list *new){
	list **p = &L[x];
	
	while((*p) != NULL){
	  p = &((*p)->next);
	}
	(*p) = new;
	
	return;
}

int push(int stack[], int x, int top){
  stack[top++] = x;
  return top;
}

int pop(int stack[], int *top){
  (*top)--;
  return stack[*top];
}

void dfs(int C[], int x, list* L[]){
  int stack[LARGE];
  int top = 0;
  int temp;
  list *p;
	
  color++;
  top = push(stack,x,top);
  while(top > 0){
    temp = pop(stack,&top);
    if(C[temp] == 0) C[temp] = color;
    p = L[temp];
    while(p != NULL){
      if(C[p->id] == 0){
	top = push(stack,p->id, top);
	C[p->id] = color;
			}
      p = p->next;
		}
  }
	
  return;
}

int main(){
  int i, j, s, t, q, x, y, C[LARGE];
  list *L[LARGE], *new;
 
  scanf("%d %d", &V, &E);
	
  for(i = 0 ; i < V ; i++){
    L[i] = NULL;
    C[i] = 0;
  }
	
  for(i = 0 ; i < E ; i++){
    scanf("%d %d", &s, &t);
    new = makelist(t);
    list_insert(L, s, new);
    new = makelist(s);
    list_insert(L, t, new);
  }
	
  scanf("%d", &q);
  for(i = 0 ; i < q ; i++){
    scanf("%d %d", &x, &y);
    if(C[x] == 0) dfs(C, x, L);
    if(C[y] == 0) dfs(C, y, L);
    if(C[x ]== C[y]) printf("yes\n");
    else printf("no\n");
  } 
		
  return 0;
}


Compiler output:
main.c: In function 'makelist':
main.c:15:15: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   15 |   list *new = malloc(sizeof(list));
      |               ^~~~~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    2 | #include<string.h>
  +++ |+#include <stdlib.h>
    3 | 
main.c:15:15: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   15 |   list *new = malloc(sizeof(list));
      |               ^~~~~~
main.c:15:15: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c: At top level:
main.c:4:11: error: expected ';', ',' or ')' before numeric constant
    4 | #define L 100000
      |           ^~~~~~
main.c:21:24: note: in expansion of macro 'L'
   21 | void list_insert(list* L[], int x, list *new){
      |                        ^
main.c:4:11: error: expected ';', ',' or ')' before numeric constant
    4 | #define L 100000
      |           ^~~~~~
main.c:42:32: note: in expansion of macro 'L'
   42 | void dfs(int C[], int x, list* L[]){
      |                                ^
main.c: In function 'main':
main.c:67:30: error: 'LARGE' undeclared (first use in this function)
   67 |   int i, j, s, t, q, x, y, C[LARGE];
      |                              ^~~~~
main.c:67:30: note: each undeclared identifier is reported only once for each function it appears in
main.c:4:11: error: expected identifier or '(' before numeric constant
    4 | #define L 100000
      |           ^~~~~~
main.c:68:9: note: in expansion of macro 'L'
   68 |   list *L[LARGE], *new;
      |         ^
main.c:73:6: error: subscripted value is neither array nor pointer nor vector
   73 |     L[i] = NULL;
      |      ^
main.c:79:5: error: 'new' undeclared (first use in this function)
   79 |     new = makelist(t);
      |     ^~~
main.c:80:5: error: implicit declaration of function 'list_insert' [-Wimplicit-function-declaration]
   80 |     list_insert(L, s, new);
      |     ^~~~~~~~~~~
main.c:88:19: error: implicit declaration of function 'dfs'; did you mean 'ffs'? [-Wimplicit-function-declaration]
   88 |     if(C[x] == 0) dfs(C, x, L);
      |                   ^~~
      |                   ffs