Check if Stack is Empty or Full
📖 Scenario: Imagine you are managing a stack of books on a shelf. You want to know if the shelf is empty or completely full before adding or removing books.
🎯 Goal: You will create a simple stack using an array and write code to check if the stack is empty or full.
📋 What You'll Learn
Create an integer array called
stack with size 5Create an integer variable called
top initialized to -1Create an integer variable called
max_size set to 5Write a function
isEmpty that returns 1 if the stack is empty, else 0Write a function
isFull that returns 1 if the stack is full, else 0Print the results of
isEmpty() and isFull()💡 Why This Matters
🌍 Real World
Stacks are used in many places like undo features in apps, browser history, and managing tasks.
💼 Career
Understanding stack operations is important for software development, debugging, and working with system internals.
Progress0 / 4 steps
