Javatpoint Logo
Javatpoint Logo

C++ String c_str()

This function returns a pointer to an array that contains null terminated sequence of characters.

Syntax

Consider a string str. Syntax would be:

Parameter

It does not contain any parameter.

Return value

It returns a pointer to the c-string representation of the string object's value.

Example

Let's see the simple example.

Output:

String value is: Computer is my favorite subject

Next TopicC++ Strings





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA