I keep getting this warning every time I compile the following code.
Can anyone please tell me what I am doing wrong.
Also, the printf(head->data) keeps saying that printf's argument is invalid. How do I print head's data?
Any help is appreciated.
Thanks,
#include<stdio.h>
#include<malloc.h>
typedef struct
{
int data;
struct element *next;
}node;
main()
{
node *head;
insert(&head);
printf(head->data);
}
insert(node **head)
{
node *newElem;
newElem= (node *)malloc (sizeof(node));
if(!newElem)
{
return 0;
}
newElem->next=head;
head=newElem;
head->data=45;
return 1;
}