Using a Pointer with an Array - C++ Data Type

C++ examples for Data Type:Array Pointer

Description

Using a Pointer with an Array

Demo Code


#include <iostream>
using namespace std;
int main(int argc, char *argv [])
{ 
        int intArray[5] = { 0, 1, 2, 3, 4 }; 
  
        cout << "Value: " << *intArray << endl; 
        cout << "Value: " << *(intArray + 1) << endl; 
        cout << "Value: " << *(intArray + 2) << endl; 
        cout << "Value: " << *(intArray + 3) << endl; 
        cout << "Value: " << *(intArray + 4) << endl; 
        return 0; 
}

Related Tutorials