using an array as function parameter

I tried to implement a function with the following prototype but I got an error during the compilation time. void print_tab(int tab[][]) after I remplaced the 'int tab[][]' with 'int tab[][N]' the error gone, (N is a constant defined using #define). can someone explain me why?

3/24/2020 7:06:44 PM

John Robotane

2 Answers

New Answer


The following links might be able to help you: https://stackoverflow.com/questions/12813494/why-do-we-need-to-specify-the-column-size-when-passing-a-2d-array-as-a-parameter https://www.dummies.com/programming/cpp/passing-multidimensional-arrays-in-c/ https://www.quora.com/Why-do-dimensions-beyond-the-first-in-a-multidimensional-array-in-C-have-to-be-specified-in-the-function-header-when-they-are-passed-a-parameter


it helpes me a lot! thanks.