.size()

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:

Code
Output
Loading...

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn C++ on Codecademy