Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a program to implement a stack using a linked list.

Hard

Problem 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; }
Log in or sign up to run or submit your code.Log inSign up
Input
Push(10), Push(20), Pop()
Expected Output
Popped Element = 20