FelB FelB - 1 year ago 80
C++ Question

What is "int * a[][10];"?

The question is in the title:

What is

int * a[][10];

Is it an array of pointers to arrays of int? I tried to youse the clockwise/spiral rule but I am not sure...

Answer Source
int * a[][10];

is an illegal declaration in C++, as the storage size isn't known. You need to initialize it with arrays of 10 pointers to int, like so:

int* a[][10] = {{nullptr}}; // initialize with one array, the latter consisting of null pointers

or, even simpler,

int* a[][10] = {{}};

Once initialized, it becomes an array of arrays-10 of pointers to int.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download