adspace
How a new element can be added or pushed in a stack?
Answer Posted / Vipin Gautam
A new element can be added to a stack using the push() function in STL (Standard Template Library). This function appends an element onto the top of the stack, increasing its size by 1. Example: n```n#include <stack>nstack<int> s; // creating a stack of integersns.push(5); // adding the number 5 to the stackn```
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers