How many basic operations in the line:
int a = b++;
Since b is being incremented by one AND being stored in int a, does that mean there's 2? I just want to make sure because at first I've always considered this to be just one operation.
thanks!
There are two operations, but first operation is =
, where value of b
is assigned to a
and next is increment ++
. As you can see it is postincrement and incrementation is side-efect. On the other hand, if it vas preincrement, int a = ++b
, first operation would be increment and second assigning that incremented value of b
to a
.