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

a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if

704


Once I have used freopen, how can I get the original stdout (or stdin) back?

628


Is int a keyword in c?

557


write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.

1983


write a proram to reverse the string using switch case?

2469






Which is better pointer or array?

597


FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above

625


What are file streams?

572


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

666


Is it possible to have a function as a parameter in another function?

599


What are the characteristics of arrays in c?

616


Explain what is a const pointer?

640


What is meant by type casting?

629


Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?

2055


How #define works?

617