Language: C

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
??
#define N 2000001
??
struct node {
????????int key;
????????struct node *next;
????????struct node *prev;
};
typedef struct node *NodePointer;
??
typedef struct{
????????char ask[20];
????????int key2;
}Roll;
??
NodePointer insert(int);
NodePointer finditem(int);
NodePointer delete(int);
void deleteFirst(void);
void deleteLast(void);
void list(void);
??
NodePointer head;
Roll Ask[N];
??
int main() {
??
????????int n;
????????int i;
??
??
????????scanf("%d", &n);
????????head = (NodePointer)malloc(sizeof(struct node));
????????head->next = NULL;
????????head->key = 0;
??
??
????????for (i = 0; i < n; i++) {
????????????????scanf("%s", Ask[i].ask);
??
????????????????if(strcmp(Ask[i].ask, "deleteFirst") == 0) {
????????????????????????deleteFirst();
????????????????}
????????????????else if (strcmp(Ask[i].ask, "deleteLast") == 0) {
????????????????????????????????deleteLast();
????????}
????????else {
????????????????scanf("%d", &Ask[i].key2);
????????????????if (strcmp(Ask[i].ask, "insert") == 0)
????????????????????????insert(Ask[i].key2);
????????????????else if (strcmp(Ask[i].ask, "delete") == 0)
????????????????????????delete(Ask[i].key2);
????????}
??????????????????
}
??
????????list();
??
????????return 0;
}
NodePointer insert(int keydata) {
????????NodePointer newnode,n;
????????newnode = (NodePointer)malloc(sizeof(struct node));
????????????????newnode->next = head->next;
????????????????newnode->key = keydata;
????????????????if (head->next != NULL)
????????????????newnode->next->prev = newnode;
????????????????head->next = newnode;
????????????????newnode->prev = head;
????????????????return newnode;
??
}
NodePointer finditem(int value) {
????????NodePointer n;
????????for (n = head; n -> next != NULL; n = n->next) {
????????????????if (n->next->key == value) return n;
????????}
????????return NULL;
}
??
void list(void) {
????????NodePointer n;
for (n = head->next; n->next != NULL; n = n->next) {
????????printf("%d ", n->key);???? 
??
}
????????printf("%d", n->key);
????????printf("\n");
}
NodePointer delete(int keydata) {
????????NodePointer n, delnode;
????????if ((n = finditem(keydata)) != NULL) {
????????????????delnode = n->next;
????????????????n->next = delnode->next;
????????????????if(n->next!=NULL)
????????????????n->next->prev = n;
????????????????free(delnode);
????????????????return n;
????????}
????????else return NULL;
}
void deleteFirst(void) {
????????NodePointer delnode;
????????delnode = head->next;
????????head->next = delnode->next;
????????head->next->prev = head;
????????free(delnode);
??
}
void deleteLast(void){
????????NodePointer n,delnode;
????????for (n = head; n->next!= NULL; n = n->next) {
????????};
????????delnode = n;
????????n->prev->next = NULL;
??
????????free(delnode);
??
}

Compiler output:
main.c:4:1: error: expected identifier or '(' before '?' token
    4 | ??
      | ^
main.c:13:1: error: expected identifier or '(' before '?' token
   13 | ??
      | ^
main.c:17:2: warning: data definition has no type or storage class
   17 | }Roll;
      |  ^~~~
main.c:17:2: error: type defaults to 'int' in declaration of 'Roll' [-Wimplicit-int]
main.c:18:1: error: expected identifier or '(' before '?' token
   18 | ??
      | ^
main.c:25:1: error: expected identifier or '(' before '?' token
   25 | ??
      | ^
main.c:27:1: error: unknown type name 'Roll'
   27 | Roll Ask[N];
      | ^~~~
main.c:28:1: error: expected identifier or '(' before '?' token
   28 | ??
      | ^
main.c: In function 'insert':
main.c:65:1: error: expected expression before '?' token
   65 | ????????NodePointer newnode,n;
      | ^
main.c:66:1: error: expected expression before '?' token
   66 | ????????newnode = (NodePointer)malloc(sizeof(struct node));
      | ^
main.c:66:9: error: 'newnode' undeclared (first use in this function); did you mean 'node'?
   66 | ????????newnode = (NodePointer)malloc(sizeof(struct node));
      |         ^~~~~~~
      |         node
main.c:66:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:66:46: error: invalid application of 'sizeof' to incomplete type 'struct node'
   66 | ????????newnode = (NodePointer)malloc(sizeof(struct node));
      |                                              ^~~~~~
main.c:67:1: error: expected expression before '?' token
   67 | ????????????????newnode->next = head->next;
      | ^
main.c:67:33: error: 'head' undeclared (first use in this function)
   67 | ????????????????newnode->next = head->next;
      |                                 ^~~~
main.c:68:1: error: expected expression before '?' token
   68 | ????????????????newnode->key = keydata;
      | ^
main.c:69:1: error: expected expression before '?' token
   69 | ????????????????if (head->next != NULL)
      | ^
main.c:71:1: error: expected expression before '?' token
   71 | ????????????????head->next = newnode;
      | ^
main.c:72:1: error: expected expression before '?' token
   72 | ????????????????newnode->prev = head;
      | ^
main.c:73:1: error: expected expression before '?' token
   73 | ????????????????return newnode;
      | ^
main.c:74:1: error: expected expression before '?' token
   74 | ??
      | ^
main.c: In function 'finditem':
main.c:77:1: error: expected expression before '?' token
   77 | ????????NodePointer n;
      | ^
main.c:78:1: error: expected expression before '?' token
   78 | ????????for (n = head; n -> next != NULL; n = n->next) {
      | ^
main.c: At top level:
main.c:83:1: error: expected identifier or '(' before '?' token
   83 | ??
      | ^
main.c: In function 'delete':
main.c:94:1: error: expected expression before '?' token
   94 | ????????NodePointer n, delnode;
      | ^
main.c:95:1: error: expected expression before '?' token
   95 | ????????if ((n = finditem(keydata)) != NULL) {
      | ^
main.c: In function 'deleteFirst':
main.c:106:1: error: expected expression before '?' token
  106 | ????????NodePointer delnode;
      | ^
main.c:107:1: error: expected expression before '?' token
  107 | ????????delnode = head->next;
      | ^
main.c:107:9: error: 'delnode' undeclared (first use in this function)
  107 | ????????delnode = head->next;
      |         ^~~~~~~
main.c:107:19: error: 'head' undeclared (first use in this function)
  107 | ????????delnode = head->next;
      |                   ^~~~
main.c:108:1: error: expected expression before '?' token
  108 | ????????head->next = delnode->next;
      | ^
main.c:109:1: error: expected expression before '?' token
  109 | ????????head->next->prev = head;
      | ^
main.c:110:1: error: expected expression before '?' token
  110 | ????????free(delnode);
      | ^
main.c:111:1: error: expected expression before '?' token
  111 | ??
      | ^
main.c: In function 'deleteLast':
main.c:114:1: error: expected expression before '?' token
  114 | ????????NodePointer n,delnode;
      | ^
main.c:115:1: error: expected expression before '?' token
  115 | ????????for (n = head; n->next!= NULL; n = n->next) {
      | ^
main.c:117:1: error: expected expression before '?' token
  117 | ????????delnode = n;
      | ^
main.c:117:9: error: 'delnode' undeclared (first use in this function)
  117 | ????????delnode = n;
      |         ^~~~~~~
main.c:117:19: error: 'n' undeclared (first use in this function)
  117 | ????????delnode = n;
      |                   ^
main.c:118:1: error: expected expression before '?' token
  118 | ????????n->prev->next = NULL;
      | ^
main.c:119:1: error: expected expression before '?' token
  119 | ??
      | ^
main.c:121:1: error: expected expression before '?' token
  121 | ??
      | ^