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
- vector data() function in C++ STL
- What is the size_t data type in C?
- Is there any need of "long" data type in C and C++?
- Bool data type in C++
- Derived Data Types in C++
- Static data members in C++
- Initialization of data members
- Policy based data structures in g++
- Uninitialized primitive data types in C/C++
- Data Type Ranges and their macros in C++
- C++ set for 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 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.