So how would I create an array which would contain pointers to other arrays, so that I can still access the arrays that the overall array points to? I tried this:
#include <iostream>
using namespace std;
int main (void)
{
bool (*arrays)[3], *arr1, *arr2, *arr3, *tempArr;
arr1 = new bool[2];
arr2 = new bool[2];
arr3 = new bool[2];
arr1[0] = arr2[0] = arr3[0] = 0;
arr1[1] = arr2[1] = arr3[1] = 1;
arrays[0] = arr1;
arrays[1] = arr2;
arrays[2] = arr3;
int n = 0;
while (n <= 2) {
tempArr = arrays[n];
cout << tempArr[0] << tempArr[1] << "\n";
}
}
Also, how would I make the overall array ("arrays") a pointer so that I can add new arrays to it? I made a preliminary function, but it doesn't work (note "paths" is the overall array):
void addPath (void)
{
int n = getArrayLength(paths), i = 0;
bool (*newPaths)[n + 1];
while (i < n) {
newPaths[i] = paths[i];
++i;
}
delete [] paths;
newPaths[n] = tempPath;
paths = newPaths;
}
Hopefully this isn't to confusing or absurd, and thank you for your help.