The array::data() is a built-in function in C++ STL which returns an pointer pointing to the first element in the array object.
Parameters: The function does not accept any parameters.
Return Value: The function returns an pointer.
Below programs illustrate the above function:
The array elements are: 1 2 3 4 5 The first element is:1
The array elements are: 1 2 3 4 5 The second element is: 2 The third element is: 3
- What are the data types for which it is not possible to create an array?
- Difference between fundamental data types and derived data types
- C++ Data Types
- std::string::data() in C++
- Derived Data Types in C++
- Static data members in C++
- Bool data type in C++
- Is there any need of "long" data type in C and C++?
- What is the size_t data type in C?
- Initialization of data members
- vector data() function in C++ STL
- User defined Data Types in C++
- Data Type Ranges and their macros in C++
- How to store Data Triplet in a Vector in C++?
- C++ map having key as a user define data type
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.