Array Assignment

前端 未结 3 1413
心在旅途
心在旅途 2020-12-19 14:47

Let me explain with an example -

#include 

void foo( int a[2], int b[2] ) // I understand that, compiler doesn\'t bother about the
                  


        
3条回答
  •  庸人自扰
    2020-12-19 15:16

    In the main function
    a and b are constant pointers actually they are the address of the first elements. They are like l-value. you cannot copy to l-value but you can change the value of the integers they point to.

    In the foo function
    a and b are pointers. so you can change their values.

提交回复
热议问题