Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  OUT
Language: C/C++
Code:
#include <stdio.h>
#include <stdlib.h>
 typedef struct stud{
      int x;
      struct stud *next;
}p;
p *head=NULL,*rear=NULL;
void create_new_node()
{
     p *temp;
     printf("Enter new node value: ");
     temp=(p *)malloc(sizeof(p));
     scanf("%d",&temp->x);
     if(head==NULL)
          head=rear=temp;
     else
     {
          rear->next=temp;
          rear=temp;
          rear->next=head;
     }
}
int main(void) 
{
     char y;
     do{
          create_new_node();
          printf("\nWish to continue? y/n: ");
          scanf("%c",&y);
     }while(y=='y');
     printf("The circular linked list is created");
     return 0;
}
Comments: