Add to Favorites    Make Home Page 1816 Online  
 Language Categories  
 Our Services  

Home » C Home » Data Structures Home » Circular Linked List in C

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title Circular Linked List in C
Author Jagarengan
Author Email rahul82 [at] rosecards.com
Description Implementation of Circular linked List.
Category C » Data Structures
Hits 389717
Code Select and Copy the Code
#include<stdio.h> #include<conio.h> #include<stdlib.h> #include<alloc.h> #define null 0 struct node { int info; struct node *link; }*start; void main() { int ch,n,m,position,i; last=null; while(1) { printf("1.create 2.addat 3.addbt 4.del 5.disp 6.exit "); printf("er ur ch"); scanf("%d",&ch); switch(ch) { case 1: printf("er no of itc"); scanf("%d",&n); for(i=0;i<n;i++) { printf("er the element"); scanf("%d",&m); create(m); }break; case 2: printf("er the element"); scanf("%d",&m); addat(m); break; case 3: printf("er the element"); scanf("%d",&m); printf("er the position"); scanf("%d",&position); addbt(m,position); break; case 4: if(last==null) { printf("list is empty"); continue; } printf("er the element for delete"); scanf("%d",&m); del(m); break; case 5: disp(); break; case 6: exit(0); break; default: printf("wrong choice"); } } } create(int data) { struct node *q,*tmp; tmp=(struct node *)malloc(sizeof(struct node)); tmp->info=data; tmp->link=null; if(last==null) { last=tmp; tmp->link=last; } else { tmp->link=last->link; last->link=tmp; last=tmp; }} addat(int data) { struct node *q,*tmp; tmp=(struct node *)malloc(sizeof(struct node)); tmp->info=data; tmp->link=last->link; last->link=tmp; } addbt(int data,int pos) { struct node *tmp,*q; int i; q=last->link;; for(i=0;i<pos-1;i++) { q=q->link; if(q==last->link) { printf("there r lessthan %d elements",pos); return; } } tmp=(struct node *)malloc(sizeof(struct node)); tmp->link=q->link; tmp->info=data; q->link=tmp; if(q==last) last=tmp; } del(int data) { struct node *tmp,*q; if(last->link==last&&last->info==data) { tmp=last; last=null; free(tmp); return; } q=last->link; if(q->info==data) { tmp=q; last->link=q->link; free(tmp); return; } while(q->link!=last) { if(q->link->info==data) { tmp=q->link; q->link=tmp->link; free(tmp); printf("element %d is deleted",data); } if(q->link->info=data) { tmp=q->link; q->link=last->link; free(tmp); last=q; return;} printf("element%d is not found",data); } disp() { struct node *q; if(last==null) { printf("list isdempty"); return; }q=last->link; while(q!=last) { printf("%d",q->info); q=q->link; } printf("%d",last->info); }

Related Source Codes

Script Name Author
The Game Opposite as seen on Nokia 2300 Mobile Manikanta
RECURSIVE BALANCED QUICK SORT ashish
Radix Sort ashish
Change your mouse pointer Ashim
The blinking star Shashank
Data Validation Crylittlebaby
To search a file by giving file type like mp3 or mpeg or doc Prashanth SR
Menus Demonstration B.Chidhambaram
Employee Database Project Using C. Reenku Raman Nayak
Creating a Lexical Analyzer in c fahad bader al-buhairi �դ ?�� ��??���
Calendar Program Omkar & Devendra
Stop double Process for start in C Cedrik Jurak
Stop double Process for start in C Cedrik Jurak
Time Scheduler Atiq Anwar
A timepass game between atmost two players Rahul Roy

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions | Important Websites
Copyright ©2003-2024 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=758


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review