Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
c program of linked list education info
SUBMITTED BY:
deymen
DATE:
July 24, 2016, 4:54 p.m.
FORMAT:
Text only
SIZE:
809 Bytes
Raw
Download
Tweet
HITS:
3580
Go to comments
Report
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
struct node
{
int data;
struct node *next;
}*start=NULL;
void create()
{
char ch;
do
{
struct node *current,*new_node;
new_node=(struct node*)malloc(sizeof(struct node));
printf("\n enter the data to node");
scanf("%d",&new_node->data);
new_node->next=NULL;
if(start==NULL)
{
start=new_node;
current=new_node;
}
else
{
current->next=new_node;
current=new_node;
}
printf("\n do you want to create another node:");
ch=getche();
}while(ch!='n');
}
void display()
{
struct node*temp=start;
printf("\n the linked list is :");
while(temp!=NULL)
{
printf("%d--->",temp->data);
temp=temp->next;
}
printf("NULL");
}
void main()
{
create();
display();
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus