Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 451 Bytes

size.md

File metadata and controls

20 lines (16 loc) · 451 Bytes

size

Description : size() function is used to return the size of the satck or the number of elements in the stack.

Example:

    // Empty stack 
    std::stack<int> mystack;
	mystack.push(4);
	mystack.push(5);
	mystack.push(9);
	mystack.push(1);
	mystack.push(3);

	// Stack from top to bottom becomes 3, 1, 9, 5, 4

	// Print the size of mystack (5)
	std::cout << mystack.size();

Run Code