Can anyone check this program?
I got some warning.
#include<stdio.h>
#include<stdlib.h>
void func(struct node *);
struct node
{
int data;
struct node *next;
};
int main()
{
struct node *head=(struct node *)malloc(sizeof(struct node));
struct node *temp=(struct node *)malloc(sizeof(struct node));
struct node *first=(struct node *)malloc(sizeof(struct node));
head->data=10;
head->next=temp;
temp->data=20;
temp->next=first;
first->data=30;
first->next=NULL;
func(head);
return 0;
}
void func(struct node *p)
{
if(p)
{
printf("\n%d",p->data);
func(p->next);
}
}