.size()

Published Jul 29, 2022Updated Dec 21, 2022
Contribute to Docs

The .size() method returns the number of elements in the stack.

Syntax

The .size() method is called on a stack using the following syntax:

stackName.size();

Codebyte Example

The following example uses the .size() method on myStack:

us
Visit us
code
Hide code
Code
Output
Hide output
Hide output
Loading...

All contributors

Looking to contribute?

Learn C++ on Codecademy