Write a program to implement a stack using a linked list.
HardProblem Statement
Write a program to implement a stack using a linked list.
Sample Input
Push(10), Push(20), Pop()
Sample Output
Popped Element = 20
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
#include <stdio.h>
#include <stdlib.h>
struct Node {
int data;
struct Node *next;
};
void push(struct Node **top, int data);
int pop(struct Node **top);
int main() {
struct Node *top = NULL;
// Logic for push and pop operations
return 0;
}
Input
Push(10), Push(20), Pop()
Expected Output
Popped Element = 20