why this code can run ? double a[3]; a[1,1]=1;

后端 未结 3 1520
攒了一身酷
攒了一身酷 2021-01-29 04:38
int main()
{
    double a[3];  
    a[1,1]=1;
}

It passes the vs2013 compiler, and it is not 2D array.

3条回答
  •  轮回少年
    2021-01-29 05:00

    a[1,1]=1;
    

    is equivalent to:

    a[1]=1;
    

    The expression 1,1 evaluates to 1, because the first 1 is discarded and only the second 1 is evaluated. Read up on the comma operator for more info.

提交回复
热议问题