0
void fun(int b1[]){}
int main()
{
    int a1[4]={1,2,3,4};
    int b[]=a1; //error
    fun(a1);// works fine

}

how is b1 assigned to a1?. Why is it not same as int b[]=a1;?

Alex
  • 1,178
  • 3
  • 9
  • 24
  • You can't do what you are doing. int *b = a1 – Alexis Jul 09 '13 at 07:54
  • `b[]` as a function parameter is treated as a pointer simply without checking the size of the array. Address of the array `a1` is converted to a pointer when it is passed as a parameter. – BLUEPIXY Jul 09 '13 at 10:23

0 Answers0