Hello everyone,I'm a new one in C++ and here.
Could anyone please tell me what does the formal parameter of the below function mean?
in which NUM is a predefined fixed number.
func(int array[][NUM])
I know its a two dimension array,what I really want to know is why there is nothing in first [],and NUM in the second [] as the actual parameter is "array[NUM][NUM]"? What does this form implicate and why cannot int[][] do?
This form implicate that this is a build-in array or a c array. That means the size must be know at compilation. The parameter scope needs at least the column size . You can also pass an int** or an int(a)[NUM] if I am not wrong where a is the name . That prevents also from out-range . The way to choice between is to ask yourself wether you know the size already or it will be defined at runtime.