Code:
#include<stdio.h>
#include<stdlib.h>
typedef struct Node
{
char data[10];
struct Node *next;
}node;
void insertnode(char str1,node *head);
int main()
{
char str1[10];
node *temp,*head;
temp=head;
temp->next=NULL;
printf("enter the name:");
scanf("%s",str1);
/*printf("enter your name");
scanf("%s",temp->data);*/
insertnode(str1,head);
while(temp->next!=NULL)
printf("%s\n",temp->data);
return(0);
}
void insertnode(char str1,node *head)
{
node *temp,*ptr;
temp=head;
while(temp->next!=NULL)
temp=temp->next;
ptr=(node*)malloc(sizeof(node));
temp->next=ptr;
ptr->data=str1;
ptr->next=NULL;
}
what is wrong int this code..
again finding compilation errors....help me guys