#include <stdio.
h>
#include <stdlib.h>
// Define a structure for a node in the linked list
struct Node {
int data; // Data part to store an integer
struct Node* next; // Pointer to the next node
};
int main() {
// Create three nodes
struct Node* head = NULL;
struct Node* second = NULL;
struct Node* third = NULL;
// Allocate memory for three nodes in the linked list
head = (struct Node*)malloc(sizeof(struct Node));
second = (struct Node*)malloc(sizeof(struct Node));
third = (struct Node*)malloc(sizeof(struct Node));
// Assign data and link the nodes
head->data = 1; // First node has data 1
head->next = second; // First node points to second node
second->data = 2; // Second node has data 2
second->next = third; // Second node points to third node
third->data = 3; // Third node has data 3
third->next = NULL; // Third node is the last node, points to NULL
// Display the linked list
struct Node* temp = head; // Temporary pointer to traverse the list
while (temp != NULL) {
printf("%d -> ", temp->data); // Print the data of each node
temp = temp->next; // Move to the next node
printf("NULL\n");
return 0;