Professional Documents
Culture Documents
#include<stdio.h>
#include<conio.h>
struct list
{
int data;
struct list *link;
}*start;
void create(int m)
{
struct list *tmp,*q;
tmp=(struct list *)malloc(sizeof(struct list));
tmp->data=m;
tmp->link=NULL;
if(start==NULL)
start=tmp;
else
q=start;
while(q->link!=NULL)
{
q=q->link;
}
q->link=tmp;
}
void disp()
{
struct list *q;
if(start==NULL)
printf(\n\n LIST IS EMPTY);
else
{
q=start;
while(q!=NULL)
{
printf(%d->,q->data);
q=q->link;
}
}
}
void sort()
{
struct list *q,*p;
int data;
q=start;
while(q!=NULL)
{
p=q->link;
while(p!=NULL)
{
if(q->data>p->data)
{
data=q->data;
q->data=p->data;
p->data=data;
}
p=p->link;
}
q=q->link;
}
}
void main()
{
int ch,m,i,n;
clrscr();
do
{
printf(\n\n1.create \n\n2.display \n\n3.sort \n\n4.Exit\n\n);
printf(\n\nENTER UR CHOICE);
scanf(%d,&ch);
switch(ch)
{
case 1:
printf(\n\nHOW MANY NODES);
scanf(%d,&n);
for(i=0;i<n;i++)
{
printf(\n\nENTER THE DATA);
scanf(%d,&m);
create(m);
}
break;
case 2:
disp();
break;
case 3:
sort();
break;
case 4:
exit(0);
}
}
while(ch!=4);
getch();
}
Share this:
Google
Facebook1
Twitter
LinkedIn
Email
LEAVE A REPLY
C PROGRAMMING
Simple Program
Complex Program
Graphic Program
C++ PROGRAMMING
PL/SQL
Queries
Cursor
Functions
Procedure
Triggers
VB Simple Program
VB Complex Program
JAVA
Core Java
Java Scripting and HTML
DOWNLOAD SOFTWARES
STUFF I COOKED
In Windows 7
In Windows Xp
In Linux
OWNER
Pratik Mahale
CONTACT
Contact Me
LIKE ON FACEBOOK
MY TWITTER
This is What I predict today and its turn to Reality :( Warning! Your Location has been Shared 5,398 Times
in... fb.me/7qQhuoWye 1 week ago
Critical #vulnerability in MongoDB allows Hackers to Remotely Crash (#DoS Attack) the database
application.... fb.me/7cGpSJhQi 1 week ago
From China With Love, #GitHub hit by Massive #DDoS Attackthn.li/88cd 1 week ago
:p :D fb.me/4GkdxTEoT1 week ago
Shahid Afridi Official Websitefb.me/6yGAbtGL0 1 week ago
Blog at WordPress.com. | The Dusk To Dawn Theme.
Follow
Follow Bedeveloper
Get every new post delivered to your Inbox.
Sign me up
Build a website with WordPress.com