Linked List Circular Operation
Linked List Circular Operation
#include <stdio.h>
#include <stdlib.h>
struct node{
int data;
};
//helper function
int size = 0;
size++;
return size;
{
size++;
size++;
return size;
if (*headPointer == NULL)
*headPointer = node;
return;
cursor = *headPointer;
return;
//insertion
cursor = *headPointer;
printf("crossed index");
return;
}
if (index == size && index != 0) //last element
return;
//put at specified index and push the other one one step below
//deletion
cursor = *headPointer;
int size = size_list(headPointer) - 1;
return;
free(to_null);
return;
free(cursor);
//traversal
{
struct node *cursor = *headPointer;
int main() {
create(&head , 10);
create(&head , 20);
create(&head , 50);
create(&head , 30);
create(&head , 1000);
create(&head , 59580);
create(&head , 3230);
printLinkList(&head);
insert(&head , 3 , 1);
printLinkList(&head);
delete_list(&head , 3);
printLinkList(&head);
return 0;