Javatpoint Logo
Javatpoint Logo

C++ String empty()

This function checks whether the string is empty or not. Function returns a Boolean value either true or false.

Syntax

Consider a string str. Syntax would be:

Parameter

This function does not contain any parameter.

Return value

It returns a Boolean value either 0 or 1 depending upon the conditions.

Example 1

Output:

String is empty

This example shows how to check the string whether it is empty or not by using empty() function.

Example 2

Output:

String is not empty

This example checks whether the string is empty or not by using empty() function.


Next TopicC++ Strings




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA