Write a program to implement a simple linked list and display its elements.
HardProblem Statement
Write a program to implement a simple linked list and display its elements.
Sample Input
Insert(10), Insert(20), Insert(30)
Sample Output
Linked List: 10 -> 20 -> 30 -> NULL
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
#include <stdio.h>
#include <stdlib.h>
struct Node {
int data;
struct Node *next;
};
void insert(struct Node **head, int data);
int main() {
struct Node *head = NULL;
// Logic to insert and display linked list
return 0;
}
Input
Insert(10), Insert(20), Insert(30)
Expected Output
Linked List: 10 -> 20 -> 30 -> NULL