.size()

garanews's avatar
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:

Code
Output
Loading...

All contributors

Contribute to Docs

Learn C++ on Codecademy