Computer Science, asked by chandrasenap0987, 4 months ago

In Unary increment
a=48;

a = a++ + ++a
I asked my friends they just gave the answer as
48 + 50 = 98


But I’m not sure why the values are 48 and 50 and not 49 and 49.
Please some1 explain.Pls no joke.

Answers

Answered by Imblank
1

Answer:

first you initialise a = 48

Then use an increment a++ which makes it 49 but in second operation

which means equation will be like this

a = (48)++ ++a

a = 48 + ++a

Now a is 49 and you use first increment which makes it 50 first

a = 48 + ++(49)

a = 48 + 50

a = 98

Got it?

Read my bio once

Similar questions