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
Printable View
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. :p
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. :p
I think this will work, at least for signed values.
x = -~x;
i|=1 ... sometimes...:)