C++ examples for Data Type:Array Pointer
Use a for statement to print the elements of array values using pointer/offset notation with the array name as the pointer
#include <iomanip> #include <iostream> int main(int argc, const char *argv[]) { const int SIZE = 5; unsigned int values[SIZE] = {2, 4, 6, 8, 10}; unsigned int *vPtr; vPtr = values;// w w w . jav a2 s. c om for (int i = 0; i < SIZE; ++i) { std::cout << std::setw(4) << *(values + i); } }