Javatpoint Logo
Javatpoint Logo

C++ List empty()

C++ List empty() function checks whether the list is empty or not. It returns true, if the list is empty otherwise false. It does not modify the content of the list.

Syntax

Parameter

It does not contain any parameter.

Return value

It returns boolean value either 1 or 0. If the list is empty, it returns 1 otherwise 0.

Example 1

Let's see a simple example when the list is empty.

Output:

empty() : 1

In this example, empty() function returns the value 1 as the list 'li' is empty.

Example 2

Let's see a simple example when the list is not empty.

Output:

empty() : 0

In this example, the empty() function returns the value '0' as the list is not empty.


Next Topicsize() Function



Help Others, Please Share

facebook twitter pinterest