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
Are there namespaces in c?
What does the function toupper() do?
Write a program to swap two numbers without using third variable in c?
Can we assign integer value to char in c?
process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,
What does 2n 4c mean?
Why use int main instead of void main?
What is data type long in c?
Do pointers store the address of value or the actual value of a variable?
Suggesting that there can be 62 seconds in a minute?
What is void main ()?
Explain what are the standard predefined macros?
Is array a primitive data type in c?
what are bit fields? What is the use of bit fields in a structure declaration?
What is define directive?