Code for Circular Linked List c-programing
#include<stdio.h> #include<conio.h> #include<stdlib.h> struct node { int data; struct node *next; }; struct node *head; void InsertAtBeginning(int x) { struct node *temp = (struct node *)malloc(sizeof(struct node)); struct node *temp2 = head; temp->data = x; temp->next = NULL; if(temp==NULL) { printf("\n MEMORY UNAVAILABLE"); } if(head==NULL) { head = temp; temp->next = head; } if(temp2->next!=head) { temp2 = temp2->next; } temp->next = head; head = temp; temp2->next = head; } void InsertAtEnd(int y) { struct node *temp = (struct node *)malloc(sizeof(struct node)); struct node *temp2; temp->data = y; temp->next = NULL; if(temp==NULL) { printf("\n MEMORY UNAVAILABLE"); } if(head==NULL) { ...
Comments
Post a Comment