what is the value of b
if a=5;
b=++a + ++a

Answer Posted / naresh

Not a very tough question. Important thing to note that in
any expression pre increment operator has a higher prority
than arithemetic operator as a result value of a is
increment is first two times then value of b is evaluated.
So b = 7*7 = 14.
in first ++a we get a=6
in next ++a we get a=7
and b=7+7=14

This question will result in same output for most of the
compilers, but some rare compiler may produce an entire
diffrenent parse tree resulting in an undefined result

Is This Answer Correct ?    28 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between call by value and call by reference in c language?

637


Why is this loop always executing once?

609


What are the general description for loop statement and available loop types in c?

678


Can you explain the four storage classes in C?

635


How do you print only part of a string?

603






Explain b+ tree?

616


Why we use void main in c?

584


Is struct oop?

573


Explain what is the difference between functions abs() and fabs()?

611


Can a local variable be volatile in c?

571


An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode

597


Why isn't any of this standardized in c? Any real program has to do some of these things.

617


Are the variables argc and argv are local to main?

778


Explain null pointer.

613


1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.

2328