Javatpoint Logo
Javatpoint Logo

C++ String Data()

This function copies the characters of the string into an array. It returns the pointer to an array obtained from the conversion of string into array.

Syntax

Consider a string str and pointer p. Syntax would be:

Parameter

This function does not contain any parameter.

Return value

It returns the pointer to an array.

Example 1

Output:

String contains : C++ Strings

This example displays the string using data() function.

Example 2

Output:

1245

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