[CSI] no you cannot separate increment with space

Mikhail Nesterenko mikhail at cs.kent.edu
Thu Jan 23 15:30:22 EST 2020


CSI students,

There was a question asked in class about putting a space inside the
increment/decrement operator like so:

a = + +b;

The answer is clear: this is illegal. However, while we are on the
subject, I have a question: is there a difference in the below code
and if yes, what is it?

     int a = 1, b = 2;
     int c = a++ +b;

and

     int a = 1, b = 2;
     int c = a+ ++b;

I'll discuss the question in class on Tuesday next week.

Thanks,
-- 
Mikhail


More information about the cs13001 mailing list