Language: C

#include<stdio.h>

struct node{
	int key;
	struct node *next;
	struct node *prev;
};

typedef struct node * NodePointer;
NodePointer insert(int);
NodePointer finditem(int);
void listprint(void);
NodePointer make_1node(int,NodePointer);
void deleteFirst(void);
void deleteLast(void);
void deleteNode(NodePointer);
NodePointer head;

int main(void){
	int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
    if ( com[6] == 'F' ) deleteFirst();
    else if ( com[6] == 'L' ) deleteLast();
      } else {
    delete(key); nd++; 
      }
      size--;
    }
  }
   
  listprint();
  return 0;
}

NodePointer finditem(int key){
  NodePointer x;
  x = head->next;
  while(x != head && x->key != key){
    x = x->next;
  }
  return x;
}

void insert(int key){
  NodePointer y;
  y = malloc(sizeof(struct node));
  y->key = key;
  y->next = head->next;
  head->next->prev = y;
  head->next = y;
  y->prev = head;
   
}

void listprint(){
  NodePointer cur = head->next;
  int isf = 1;
  while(1){
    if ( cur == head ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}
 
void deleteFirst(){
  NodePointer t = head->next;
  if ( t == head ) return;
  deleteNode(t);
}
 
void deleteLast(){
  NodePointer t = head->prev;
  if ( t == head ) return;
  deleteNode(t);
}
 
void delete(int key){
  NodePointer k;
  k=finditem(key);
  if(k == head) return;
   
  deleteNode(k);
   
}
void init(){
  head = malloc(sizeof(struct node));
  head->next = head;
  head->prev = head;
}

Compiler output:
main.c: In function 'main':
main.c:25:3: error: implicit declaration of function 'init' [-Wimplicit-function-declaration]
   25 |   init();
      |   ^~~~
main.c:30:11: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
   30 |       if (strlen(com) > 6){
      |           ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strlen'
    1 | #include<stdio.h>
  +++ |+#include <string.h>
    2 | 
main.c:30:11: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
   30 |       if (strlen(com) > 6){
      |           ^~~~~~
main.c:30:11: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:34:5: error: implicit declaration of function 'delete'; did you mean 'deleteNode'? [-Wimplicit-function-declaration]
   34 |     delete(key); nd++;
      |     ^~~~~~
      |     deleteNode
main.c: At top level:
main.c:53:6: error: conflicting types for 'insert'; have 'void(int)'
   53 | void insert(int key){
      |      ^~~~~~
main.c:10:13: note: previous declaration of 'insert' with type 'struct node *(int)'
   10 | NodePointer insert(int);
      |             ^~~~~~
main.c: In function 'insert':
main.c:55:7: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   55 |   y = malloc(sizeof(struct node));
      |       ^~~~~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    1 | #include<stdio.h>
  +++ |+#include <stdlib.h>
    2 | 
main.c:55:7: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   55 |   y = malloc(sizeof(struct node));
      |       ^~~~~~
main.c:55:7: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c: In function 'deleteNode':
main.c:80:3: error: implicit declaration of function 'free' [-Wimplicit-function-declaration]
   80 |   free(t);
      |   ^~~~
main.c:80:3: note: include '<stdlib.h>' or provide a declaration of 'free'
main.c:80:3: warning: incompatible implicit declaration of built-in function 'free' [-Wbuiltin-declaration-mismatch]
main.c:80:3: note: include '<stdlib.h>' or provide a declaration of 'free'
main.c: At top level:
main.c:95:6: warning: conflicting types for 'delete'; have 'void(int)'
   95 | void delete(int key){
      |      ^~~~~~
main.c:34:5: note: previous implicit declaration of 'delete' with type 'void(int)'
   34 |     delete(key); nd++;
      |     ^~~~~~
main.c:103:6: warning: conflicting types for 'init'; have 'void()'
  103 | void init(){
      |      ^~~~
main.c:25:3: note: previous implicit declaration of 'init' with type 'void()'
   25 |   init();
      |   ^~~~
main.c: In function 'init':
main.c:104:10: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
  104 |   head = malloc(sizeof(struct node));
      |          ^~~~~~
main.c:104:10: note: include '<stdlib.h>' or provide a declaration of 'malloc'