Created basic linked list

This commit is contained in:
SF
2026-07-30 06:31:27 +00:00
parent 28364c2f27
commit 7a123d5f21
4 changed files with 53 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
#include <stdio.h>
#include <stdlib.h>
#include "linkedlist.h"
Node *head = NULL;
void insert(int data)
{
Node *newNode = malloc(sizeof(Node));
newNode->data = data;
newNode->next = head;
head = newNode;
}
void display()
{
Node *temp = head;
while(temp != NULL)
{
printf("%d ", temp->data);
temp = temp->next;
}
}