指针变量使用前++和+1编译结果不同

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

指针变量使用前++和+1编译结果不同

304 Views
steven_zhang
Contributor V

用codeworrior 编译 ZVMC25 工程,

我们的指针变量使用前+++1编译结果不同,用前++是错误的,用+1是对的,请问是什么原因?

0 Kudos
1 Reply

241 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello Steven,

About ++i the i is incremented

i=0;

y= ++i; // y=1,  i=1

About i+1 the i is not incremented

i=0;

x= i+1; // x=1,  i=0

If it is not a source of your issue I recommend you to look at the Disassembly window in the CodeWarrior (Window -> Show view -> Disassembly)

I hope it helps.

Best Regards,

Diana

0 Kudos