Language: C

#include<stdio.h>
#include<stdlib.h>

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

 typedef struct Node *Nodepointer

 Nodepointer *nil;

 void init(){
          nil=malloc(sizeof(struct Node));

          nil->prev=nil;
          nil->next=nil;
          }

 void printlist(){
          Nodepointer ser=nil->next;
          int isf=1;

          while(1){
                 if(ser==nil)break;
                 if(isf==0)printf(" ");
                 printf("%d",ser->key);
                 ser=ser->next;
                 isf=0;
                 }
          pritf("\n");
          }


 int insert(int key){
          Nodepointer x=malloc(sizeof(struct Node));
          x->key=key;

          nil->next->prev=x;
          x->next=nil->next;
          nil->next=x;
          x->prev=nil;
          }

 Nodepointer serch(int key){
          Nodepointer *ser=nil->next;
          while(ser != nil && ser->key != key){
                       ser=ser->next;
                       }
          return ser;
          }
          

 void delete(Nodepointer x){
          if(x==nil)return;
          x->prev->next=x->next;
          x->next->prev=x->prev;
          free(x);
          }

 void deletefirst(){
          delete(nil->next);
          }

 int deletelast(){
          delete(nil->prev);
          }

 int deletekey(int key){
          delete(serch(key));
          }

 int main(){
       int i,n,k;
       char com[20];
       init();
       scanf("%d",&n);
       for(i=0;i<n;i++){
                 scanf("%s %d",&com,&k);
                 if(strlen(com)<=6){
                                 if(com[6]=='t'){insert(k);}
                                 else if(com[6]=='e'){deletekey(k);}
                 else if(com[7]=='F'){deletefirst();}
                 else if(com[7]=='L'){deletelast();}
                 }
       printlist();
       return 0:
       }







Compiler output:
main.c:12:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Nodepointer'
   12 |  Nodepointer *nil;
      |  ^~~~~~~~~~~
main.c:12:2: error: unknown type name 'Nodepointer'
main.c: In function 'init':
main.c:15:11: error: 'nil' undeclared (first use in this function)
   15 |           nil=malloc(sizeof(struct Node));
      |           ^~~
main.c:15:11: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'printlist':
main.c:22:11: error: unknown type name 'Nodepointer'
   22 |           Nodepointer ser=nil->next;
      |           ^~~~~~~~~~~
main.c:22:27: error: 'nil' undeclared (first use in this function)
   22 |           Nodepointer ser=nil->next;
      |                           ^~~
main.c:28:33: error: invalid type argument of '->' (have 'int')
   28 |                  printf("%d",ser->key);
      |                                 ^~
main.c:29:25: error: invalid type argument of '->' (have 'int')
   29 |                  ser=ser->next;
      |                         ^~
main.c:32:11: error: implicit declaration of function 'pritf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   32 |           pritf("\n");
      |           ^~~~~
      |           printf
main.c: In function 'insert':
main.c:37:11: error: unknown type name 'Nodepointer'
   37 |           Nodepointer x=malloc(sizeof(struct Node));
      |           ^~~~~~~~~~~
main.c:37:25: error: initialization of 'int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
   37 |           Nodepointer x=malloc(sizeof(struct Node));
      |                         ^~~~~~
main.c:38:12: error: invalid type argument of '->' (have 'int')
   38 |           x->key=key;
      |            ^~
main.c:40:11: error: 'nil' undeclared (first use in this function)
   40 |           nil->next->prev=x;
      |           ^~~
main.c:41:12: error: invalid type argument of '->' (have 'int')
   41 |           x->next=nil->next;
      |            ^~
main.c:43:12: error: invalid type argument of '->' (have 'int')
   43 |           x->prev=nil;
      |            ^~
main.c: At top level:
main.c:46:2: error: unknown type name 'Nodepointer'
   46 |  Nodepointer serch(int key){
      |  ^~~~~~~~~~~
main.c: In function 'serch':
main.c:47:11: error: unknown type name 'Nodepointer'
   47 |           Nodepointer *ser=nil->next;
      |           ^~~~~~~~~~~
main.c:47:28: error: 'nil' undeclared (first use in this function)
   47 |           Nodepointer *ser=nil->next;
      |                            ^~~
main.c:48:34: error: request for member 'key' in something not a structure or union
   48 |           while(ser != nil && ser->key != key){
      |                                  ^~
main.c:49:31: error: request for member 'next' in something not a structure or union
   49 |                        ser=ser->next;
      |                               ^~
main.c:51:18: error: returning 'int *' from a function with return type 'int' makes integer from pointer without a cast [-Wint-conversion]
   51 |           return ser;
      |                  ^~~
main.c: At top level:
main.c:55:14: error: unknown type name 'Nodepointer'
   55 |  void delete(Nodepointer x){
      |              ^~~~~~~~~~~
main.c: In function 'deletefirst':
main.c:63:11: error: implicit declaration of function 'delete' [-Wimplicit-function-declaration]
   63 |           delete(nil->next);
      |           ^~~~~~
main.c:63:18: error: 'nil' undeclared (first use in this function)
   63 |           delete(nil->next);
      |                  ^~~
main.c: In function 'deletelast':
main.c:67:18: error: 'nil' undeclared (first use in this function)
   67 |           delete(nil->prev);
      |                  ^~~
main.c: In function 'main':
main.c:81:21: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
   81 |                  if(strlen(com)<=6){
      |                     ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strlen'
    2 | #include<stdlib.h>
  +++ |+#include <string.h>
    3 | 
main.c:81:21: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
   81 |                  if(strlen(com)<=6){
      |                     ^~~~~~
main.c:81:21: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:88:16: error: expected ';' before ':' token
   88 |        return 0:
      |                ^
      |                ;
main.c:89:8: error: expected declaration or statement at end of input
   89 |        }
      |        ^