Language: C

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

struct Node
{
	int nKey;
	Node* pNext, *pPrev;
};

Node* pNul;

void Init()
{
	pNul = (Node*)malloc(sizeof(Node));
	pNul->pNext = pNul;
	pNul->pPrev = pNul;
}

void insert(int key)
{
	Node* pCur = (Node*)malloc(sizeof(Node));
	pCur->nKey = key;
	pCur->pNext = pNul->pNext;
	pCur->pNext->pPrev = pCur;
	//changed
	pCur->pPrev = pNul;
	pNul->pNext = pCur;
}

Node* listSearch(int key)
{
	Node* pCur = pNul->pNext;
	while (pCur->nKey != key && pCur->pNext != pNul)
	{
		pCur = pCur->pNext;
	}
	return pCur;
}

void printList()
{
	Node* pCur = pNul->pNext;
	int nIndex = 0;
	while (pCur != pNul)
	{
		if (0 != nIndex)
		{
			printf(" ");
		}
		printf("%d", pCur->nKey);
		++nIndex;
		pCur = pCur->pNext;
	}
	printf("\n");
}

void deleteNode(Node* p)
{
	p->pNext->pPrev = p->pPrev;
	p->pPrev->pNext = p->pNext;
	p->pNext = p;
	p->pPrev = p;
	free(p);
}

void deleteFirst()
{
	deleteNode(pNul->pNext);
}

void deleteLast()
{
	deleteNode(pNul->pPrev);
}

void deleteKey(int key)
{
	deleteNode(listSearch(key));
}

int main()
{
	char cod[20];
	int nkey, n;
	scanf("%d", &n);
	Init();
	for (int i = 0; i < n; ++i)
	{
		scanf("%s", cod);
		if ('i' == cod[0])
		{
			scanf("%d", &nkey);
			insert(nkey);
		}
		else if (6 < strlen(cod))
		{
			if ('L' == cod[6])
			{
				deleteLast();
			}
			else if ('F' == cod[6])
			{
				deleteFirst();
			}
		}
		else
		{
			scanf("%d", &nkey);
			deleteKey(nkey);
		}
	}
	printList();
	return 0;
}


Compiler output:
main.c:8:9: error: unknown type name 'Node'
    8 |         Node* pNext, *pPrev;
      |         ^~~~
main.c:11:1: error: unknown type name 'Node'; use 'struct' keyword to refer to the type
   11 | Node* pNul;
      | ^~~~
      | struct 
main.c: In function 'Init':
main.c:15:17: error: 'Node' undeclared (first use in this function)
   15 |         pNul = (Node*)malloc(sizeof(Node));
      |                 ^~~~
main.c:15:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:15:22: error: expected expression before ')' token
   15 |         pNul = (Node*)malloc(sizeof(Node));
      |                      ^
main.c:16:13: error: request for member 'pNext' in something not a structure or union
   16 |         pNul->pNext = pNul;
      |             ^~
main.c:17:13: error: request for member 'pPrev' in something not a structure or union
   17 |         pNul->pPrev = pNul;
      |             ^~
main.c: In function 'insert':
main.c:22:9: error: unknown type name 'Node'; use 'struct' keyword to refer to the type
   22 |         Node* pCur = (Node*)malloc(sizeof(Node));
      |         ^~~~
      |         struct 
main.c:22:23: error: 'Node' undeclared (first use in this function)
   22 |         Node* pCur = (Node*)malloc(sizeof(Node));
      |                       ^~~~
main.c:22:28: error: expected expression before ')' token
   22 |         Node* pCur = (Node*)malloc(sizeof(Node));
      |                            ^
main.c:23:13: error: request for member 'nKey' in something not a structure or union
   23 |         pCur->nKey = key;
      |             ^~
main.c:24:13: error: request for member 'pNext' in something not a structure or union
   24 |         pCur->pNext = pNul->pNext;
      |             ^~
main.c:24:27: error: request for member 'pNext' in something not a structure or union
   24 |         pCur->pNext = pNul->pNext;
      |                           ^~
main.c:25:13: error: request for member 'pNext' in something not a structure or union
   25 |         pCur->pNext->pPrev = pCur;
      |             ^~
main.c:27:13: error: request for member 'pPrev' in something not a structure or union
   27 |         pCur->pPrev = pNul;
      |             ^~
main.c:28:13: error: request for member 'pNext' in something not a structure or union
   28 |         pNul->pNext = pCur;
      |             ^~
main.c: At top level:
main.c:31:1: error: unknown type name 'Node'; use 'struct' keyword to refer to the type
   31 | Node* listSearch(int key)
      | ^~~~
      | struct 
main.c: In function 'listSearch':
main.c:33:9: error: unknown type name 'Node'; use 'struct' keyword to refer to the type
   33 |         Node* pCur = pNul->pNext;
      |         ^~~~
      |         struct 
main.c:33:26: error: request for member 'pNext' in something not a structure or union
   33 |         Node* pCur = pNul->pNext;
      |                          ^~
main.c:34:20: error: request for member 'nKey' in something not a structure or union
   34 |         while (pCur->nKey != key && pCur->pNext != pNul)
      |                    ^~
main.c:34:41: error: request for member 'pNext' in something not a structure or union
   34 |         while (pCur->nKey != key && pCur->pNext != pNul)
      |                                         ^~
main.c:36:28: error: request for member 'pNext' in something not a structure or union
   36 |                 pCur = pCur->pNext;
      |                            ^~
main.c: In function 'printList':
main.c:43:9: error: unknown type name 'Node'; use 'struct' keyword to refer to the type
   43 |         Node* pCur = pNul->pNext;
      |         ^~~~
      |         struct 
main.c:43:26: error: request for member 'pNext' in something not a structure or union
   43 |         Node* pCur = pNul->pNext;
      |                          ^~
main.c:51:34: error: request for member 'nKey' in something not a structure or union
   51 |                 printf("%d", pCur->nKey);
      |                                  ^~
main.c:53:28: error: request for member 'pNext' in something not a structure or union
   53 |                 pCur = pCur->pNext;
      |                            ^~
main.c: At top level:
main.c:58:17: error: unknown type name 'Node'
   58 | void deleteNode(Node* p)
      |                 ^~~~
main.c: In function 'deleteFirst':
main.c:69:9: error: implicit declaration of function 'deleteNode' [-Wimplicit-function-declaration]
   69 |         deleteNode(pNul->pNext);
      |         ^~~~~~~~~~
main.c:69:24: error: request for member 'pNext' in something not a structure or union
   69 |         deleteNode(pNul->pNext);
      |                        ^~
main.c: In function 'deleteLast':
main.c:74:24: error: request for member 'pPrev' in something not a structure or union
   74 |         deleteNode(pNul->pPrev);
      |                        ^~