It is a code for Linkedlist implementation in C with only one function i.e Insert an element at the beginning of the list
#include<stdio.h>
struct node{
char data;
struct node* next;
};
int main()
{
struct node* head = NULL;
head = InsertAtbeginning(head,'g'); //C4047
head = InsertAtbeginning(head,'f'); //C4047
}
struct node* InsertAtBeginning(struct node* head, char key)
{
struct node* temp = (struct node*) malloc(sizeof(struct node*));
temp->data = key;
temp->next = head;
head = temp;
return head;
}
While compiling in vscode I get the warning on the lines commented
Warning C4047: '=': 'node *' differs in levels of indirection from 'int'
How!!? I'm not returning any int value. And both the left and right operands are of the same type i.e. struct node* then how..? Any idea why it happened?