EmbLogic's Blog

#include
#include
#include
struct node
{
int roll;
char name[20];
struct node *next;
};
void creat_node(struct node * temp)
{
struct node *start;
temp->next=malloc(sizeof(struct node));
temp=temp->next;
printf(“\nentrer the roll”);
scanf(“%d”,&temp->roll);
printf(“enter the name \n”);
scanf(“%s”,temp->name);
temp->next=NULL;

}
void display_node(struct node *temp)
{
while(temp!=NULL)
{
printf(“roll is %d\n”,temp->roll);
printf(“name is %s\n”,temp->name);
temp=temp->next;
}
}
int main()
{
int i,n;

struct node *start,*temp;
start=malloc(sizeof(struct node));
temp=start;
printf(“\nentrer the roll”);
scanf(“%d”,&temp->roll);
printf(“enter the name \n”);
scanf(“%s”,temp->name);
printf(“enter the number of no. of node\n”);
scanf(“%d”,&n);
temp->next=NULL;
creat_node(temp);

for(i=0;inext;
}

display_node(start);
{
display_node(start);
}

}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>