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

Are there namespaces in c?

575


What does the function toupper() do?

661


Write a program to swap two numbers without using third variable in c?

622


Can we assign integer value to char in c?

621


process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,

1895






What does 2n 4c mean?

728


Why use int main instead of void main?

603


What is data type long in c?

628


Do pointers store the address of value or the actual value of a variable?

615


Suggesting that there can be 62 seconds in a minute?

603


What is void main ()?

617


Explain what are the standard predefined macros?

657


Is array a primitive data type in c?

584


what are bit fields? What is the use of bit fields in a structure declaration?

1504


What is define directive?

646