C++ Array Variable Array Index

Description

C++ Array Variable Array Index

#include <iostream> 
  
using namespace std; 
  
int main(int argc, char *argv [])
{ 
        int intArray[5] = { 5, 6, 7, 8, 9 }; 
  
        unsigned int index = 0; 
        cout << "Index: " << index << endl; 
        cout << "Value: " << intArray[index++] << endl; 
  
        cout << "Index: " << index << endl; 
        cout << "Value: " << intArray[index++] << endl; 
  
        cout << "Index: " << index << endl; 
        cout << "Value: " << intArray[index++] << endl; 
  
        cout << "Index: " << index << endl; 
        cout << "Value: " << intArray[index++] << endl; 
  
        cout << "Index: " << index << endl; 
        cout << "Value: " << intArray[index++] << endl; 
        return 0; 
}



PreviousNext

Related