1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
int main() {
int arr[5] = {10, 20, 30, 40, 50};
int* ptr = arr; // 'ptr' points to the first element of the array
for (int i = 0; i < 5; ++i) {
std::cout << "Value at index " << i << ": " << *(ptr + i) << std::endl;
}
return 0;
}
Back to raw_pointers