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
- std::string::data() in C++
- C++ Data Types
- Static data members in C++
- Is there any need of "long" data type in C and C++?
- Bool data type in C++
- Initialization of data members
- vector data() function in C++ STL
- Data Type Ranges and their macros in C++
- Uninitialized primitive data types in C/C++
- C++ map having key as a user define data type
- What is size_t data type in C language?
- C++ set for user define data type
- How to store Data Triplet in a Vector in C++?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.