Arrays of Pointers
C++ allows declaring arrays of pointers:
double *pointerArray[5];
Given a variable:
double a = 3.5;
its address can be assigned, for example, to the first array element:
pointerArray[0] = &a;
Example
#include <iostream>
using namespace std;
int main()
{
double *pointerArray[5];
double a = 3.5;
double b = 2.77;
pointerArray[0] = &a;
pointerArray[1] = &b;
cout << "The value pointed to by pointerArray[0] is: " << *pointerArray[0] << endl;
cout << "The value pointed to by pointerArray[1] is: " << *pointerArray[1] << endl;
}
Output
The value pointed to by pointerArray[0] is: 3.5
The value pointed to by pointerArray[1] is: 2.77