Language: C

void init(); 
void insert(int );
struct Node* listSearch(int );
void deleteNode(struct Node *);
void deleteFirst();
void deleteLast();
void deleteKey(int );
void print();
 
struct Node{
 
  int key;
  struct Node *prev;
  struct Node *next;
 
};
 
struct Node *NIL =NULL;
 
int main(){
 
  int sc,i,key;
  char c[10];
 
  init();
 
  scanf("%d",&sc);
 
  for(i = 0; i < sc; i++){
 
    scanf("%s",c);
 
    if((strcmp("insert",c)) == 0){
 
      scanf("%d",&key);
      insert(key);
     
 
    }
 
    else if((strcmp("delete",c)) == 0){
 
      scanf("%d",&key);
      deleteKey(key);
    }
 
    else if((strcmp("deleteFirst",c))==0){
 
      deleteFirst();
    }
 
    else if((strcmp("deleteLast",c))== 0){
 
       deleteLast();
 
    }
 
  }
 
  print();
 
  return 0;
 
}
 
void init(){
 
  NIL = (struct Node *)malloc(sizeof(struct Node));
 
  NIL->next  = NIL;
  NIL->prev = NIL;
 
}
 
void insert(int key){
 
  struct Node *x = (struct Node*)malloc(sizeof(struct Node));
 
 
  x -> key = key;
 
  x->next = NIL->next;
  NIL->next->prev = x;
 
  NIL->next = x;
 
  x->prev = NIL;
 
}
 
struct Node* listSearch(int key){
 
  struct Node *y = NIL->next;
 
 
  while(y != NIL && y->key != key){
 
    y = y->next;
 
  }
 
  return y;
 
}
 
void deleteNode(struct Node *x){
 
  if(x == NIL){
     
    return ;
   
  }
 
  x->prev->next = x->next;
  x->next->prev = x->prev;
 
   free(x);
 
   
}
 
void deleteFirst(){
 
  deleteNode(NIL->next);
 
}
 
void deleteLast(){
 
  deleteNode(NIL->prev);
 
}
 
void deleteKey(int key){
 
  deleteNode(listSearch(key));
}
 
void print(){
 
  struct Node *z = NIL->next;
 
  int x;
 
  while(1){
 
    if(z == NIL){
 
      break;
 
    }
 
    if(x++ > 0){
 
      printf(" ");
 
    }
 
    printf("%d", z->key);
 
    z = z->next;
 
  }
 
  printf("\n");
 
}

Compiler output:
main.c:18:19: error: 'NULL' undeclared here (not in a function)
   18 | struct Node *NIL =NULL;
      |                   ^~~~
main.c:1:1: note: 'NULL' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'
  +++ |+#include <stddef.h>
    1 | void init();
main.c: In function 'main':
main.c:27:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   27 |   scanf("%d",&sc);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | void init();
main.c:27:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   27 |   scanf("%d",&sc);
      |   ^~~~~
main.c:27:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:33:9: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   33 |     if((strcmp("insert",c)) == 0){
      |         ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'strcmp'
  +++ |+#include <string.h>
    1 | void init();
main.c: In function 'init':
main.c:68:24: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   68 |   NIL = (struct Node *)malloc(sizeof(struct Node));
      |                        ^~~~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
  +++ |+#include <stdlib.h>
    1 | void init();
main.c:68:24: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   68 |   NIL = (struct Node *)malloc(sizeof(struct Node));
      |                        ^~~~~~
main.c:68:24: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c: In function 'insert':
main.c:77:34: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   77 |   struct Node *x = (struct Node*)malloc(sizeof(struct Node));
      |                                  ^~~~~~
main.c:77:34: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c: In function 'deleteNode':
main.c:117:4: error: implicit declaration of function 'free' [-Wimplicit-function-declaration]
  117 |    free(x);
      |    ^~~~
main.c:117:4: note: include '<stdlib.h>' or provide a declaration of 'free'
main.c:117:4: warning: incompatible implicit declaration of built-in function 'free' [-Wbuiltin-declaration-mismatch]
main.c:117:4: note: include '<stdlib.h>' or provide a declaration of 'free'
main.c: In function 'print':
main.c:155:7: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
  155 |       printf(" ");
      |       ^~~~~~
main.c:155:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:155:7: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:155:7: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:159:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
  159 |     printf("%d", z->key);
      |     ^~~~~~
main.c:159:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:165:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
  165 |   printf("\n");
      |   ^~~~~~
main.c:165:3: note: include '<stdio.h>' or provide a declaration of 'printf'