Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions circular.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct node{
int info;
struct node* link;
}*new_node,*start,*temp,*last;
void create()
{
int value;
int choice;
do
{
new_node = (struct node*)malloc(sizeof(struct node));
printf("enter value");
scanf("%d",&value);
new_node->info=value;
new_node->link=NULL;
if(start==NULL)
{
start=new_node;
last=new_node;
}
else
{
last->link=new_node;
last=new_node;
last->link=start;
}
printf("press 1 to continue 0 to exit");
scanf("%d",&choice);
}
while(choice==1);
}
void display()
{
printf("linklist : ");
temp=start;
while(temp->link!=start)
{
printf("%d->",temp->info);
temp=temp->link;
}
printf("%d",temp->info);
}
int main()
{
create();
display();
return 0;
}