错误C2440初始化无法将void转换为typ

#include  #include  // self - referential structure struct listNode { char data; // each listNode contains a character struct listNode *nextPtr; //pointer to next node }; typedef struct listNode ListNode; // synonym for struct listNode typedef ListNode *ListNodePtr; // synonym for struct listnode* void insert(ListNodePtr *sPtr, char value) { ListNodePtr newPtr = malloc(sizeof(ListNode)); // create node if (newPtr != NULL) // is space availale? { newPtr->data = value; // place value in node newPtr->nextPtr = NULL; // node does not link to another node ListNodePtr previousPtr = NULL; ListNodePtr currentPtr = *sPtr; // loop to find the correct location in the list while (currentPtr != NULL && value > currentPtr->data) { previousPtr = currentPtr; // walk to... currentPtr = currentPtr->nextPtr; // ... next node } if (previousPtr == NULL) // insert new node at beginning of list { newPtr->nextPtr = *sPtr; *sPtr = newPtr; } else { previousPtr->nextPtr = newPtr; newPtr->nextPtr = currentPtr; } } else { printf("%c not inserted. No memory available. \n", value); } } 

这是我的函数,问题发生在“ListNodePtr newPtr = malloc(sizeof(ListNode));” 它说Cannoy将void转换为ListNotePtr然后它说IntelliSense:类型“void *”cannoy的值用于初始化类型“ListNodePtr”的实体

我有点困惑,因为我直接从我的演讲幻灯片中复制了这个function,但我似乎无法使它工作。 有人知道发生了什么事吗? 此函数和其他函数在main(void)中调用。 先感谢您!