int myArray[5] = {4, 6, 2, 9, 1}; int* p = myArray; cout << *p << endl; // Output: 4
#includeIn this example, the "begin" function is called on an array object created using the "array" library (which is a part of the standard library). The pointer "p" is initialized to the first element of "myArray" using the "begin" function, and the output will again be the value of the first element (4).using namespace std; int main() { array myArray{4, 6, 2}; int* p = myArray.begin(); cout << *p << endl; // Output: 4 return 0; }