Does anyone know how many different ways you can write a statement to add 1 to a variable?
i.e., x=x+1;
x++;
Thanks
Does anyone know how many different ways you can write a statement to add 1 to a variable?
i.e., x=x+1;
x++;
Thanks
x=x+1; or
x++; or
++x;, i think that's all.
Current projects:
1) User Interface Development Kit (C++)
2) HTML SDK (C++)
3) Classes (C++)
4) INI Editor (Delphi)
don't forget x+=1;
That's my personal favorite because you can increase x by any number, not just 1.
--starx
www.axisoftime.com
He he, I totally forgot about that one.
Current projects:
1) User Interface Development Kit (C++)
2) HTML SDK (C++)
3) Classes (C++)
4) INI Editor (Delphi)
I think this will work, at least for signed values.
x = -~x;
Callou collei we'll code the way
Of prime numbers and pings!
i|=1 ... sometimes...