Home » C++ String Data() function

C++ String Data() function

by Online Tutorials Library

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

You may also like