Difference between passing array, fixed-sized array and base address of array as a function parameter

后端 未结 7 861
北海茫月
北海茫月 2020-12-07 18:29

I am confused about which syntax to use if I want to pass an array of known or unknown size as a function parameter.

Suppose I have these variants for the purpose:

7条回答
  •  时光说笑
    2020-12-07 18:54

    In a one dimensional array they are all treated the same by the compiler. However for a two or more dimensional array, (e.g. myArray[10][10]), it is useful as it can be used to determine the row/column length of an array.

提交回复
热议问题