You are here:

C/operator

Advertisement


Question

hello sir

i would like to know how this statement will be evaluated by the complier.

p= ++i + ++i

please break this compound stmt into parts so that it will become easy for me to understand this .

thank you
monika

Answer
++i is a pre increment operator.
And you have two such statements in there.

So, if the value of i is 5, before executing the statement,
the first ++i will get it as 6 and the next one will get it as 7.
so, p = ++i + ++i;
becomes,
p = 6 + 7 = 13

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Narendra

Expertise

I can answer questions in C related to programming, data structures, pointers and file manipulation. I use Solaris for doing C code and if you have questions related to C programming on Solaris, I will be able to help better.

Experience

6.5

Organizations belong to
Sun Microsystems

Awards and Honors
Brain Bench Certified Expert C programmer.
Advanced System Software Certified

©2012 About.com, a part of The New York Times Company. All rights reserved.