Array increment operator in C

前端 未结 7 530
暖寄归人
暖寄归人 2020-11-28 10:13

I don\'t understand the results of following code:

#include 
#include 
int main()
{
   int a[4]={1, 3, 5, 6};
   //suppose a is         


        
7条回答
  •  春和景丽
    2020-11-28 10:40

    int a[4]={1,3,5,6}; 
    
    printf("%d\n",a++); // you should not modify array name
    
     illegal in c
    

    Assume pa is integer pointer

    A pointer is a variable, so pa=a and pa++ are legal. But an array name is not a variable; constructions like a=pa and a++ are illegal.

提交回复
热议问题