invalid types 'int[int]' for array subscript error when accessing 2D array

int child1[3] = {1, 2, 3};
int child2[3] = {4, 5, 6};
int child3[3] = {7, 8, 9};
int parent[3] = {child1, child2, child3};
int x = parent[1][1];

Returns following error when compiling:

invalid types 'int[int]' for array subscript


int x = parent[1][1];

You are accessing parent as if it was a two-dimensional array but you declared it as one-dimensional.
And, you've only declared parent as an integer array and you are trying to use it as pointer-to-integer.
parent should be declared like this:

int *parent[3] = {child1, child2, child3};


Thanks for quick reply, and it worked great thanks.