C语言:理解i++,和++i
/*************************************************************@author: LaoGu
@time: 2021/6/1
@fuction:理解i++,和++i
*************************************************************/
#include<stdio.h>
int main()
{
int i = 010;// 0是八进制的标志,所以010 = 8.
printf(" i = %d\n",i);
printf(" i = %d\n",i++); //先赋值再自加1,所以这时的i = 8, i+=1后,i=9
printf(" i = %d\n",++i); // 先自加再赋值,所以 i+=1,i = 10, 此时的i是10
}
页:
[1]