Insertion of single linked list of data structure.

  c++, question

void Insert(ElementType X, List L, Position P)
{

Position TmpCell;
 
 TmpCell =( struct Node*) malloc(sizeof(struct Node));
 if (TmpCell == NULL)
 printf("Out of space.\n");
 
 TmpCell->Element = X;
 TmpCell->Next = P->Next;
 P->Next = TmpCell;

}
This is the code that inserts the function, and the information when debugging is like this.
图片描述

I understand this code, but why is it wrong?
Thank you

Thank you all. This problem has been solved.

The pointer to be defined is not tmpCell but next