Why does 2 dimension array passing to function requires its size?

前端 未结 3 592
说谎
说谎 2021-01-20 20:39

Inspired this quiestion .

Why does -

void display(int p[][SIZE]) // allowed

and

void display(int p[][]) // not a         


        
3条回答
  •  既然无缘
    2021-01-20 21:36

    Because a 2D array is stored row wise and hence the function needs the number of columns so that it knows when the next row begins.

提交回复
热议问题