Why isn't the size of an array parameter the same as within main?

后端 未结 13 2186
[愿得一人]
[愿得一人] 2020-11-21 04:13

Why isn\'t the size of an array sent as a parameter the same as within main?

#include 

void PrintSize(int p_someArray[10]);

int main () {
           


        
13条回答
  •  故里飘歌
    2020-11-21 04:58

    The behavior is by design.

    Same syntax in function parameter declaration means completely different thing than in local variable definition.

    The reason is described in other answers.

提交回复
热议问题