what is the value of b
if a=5;
b=++a + ++a
Answers were Sorted based on User's Feedback
Answer / ashfak yeafi
The answer is 14.
The increment operator has a higher priority than the arithmetic operator.
So the equation will be,
b=7+7=14
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / vinit kumar
answer would be 14
because value will be stored in cpu register..
b=7+6
last vale is 7 then it increases two times so 7*2=14
| Is This Answer Correct ? | 5 Yes | 6 No |
Answer / goldy ramnani
13
because 1stly a=5,
then compiler compile fromleft to right,
so ++a means a=6 then
++a a=6 now a=7,lastly 7+6=13
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / pawan patil
it's very simple that value of b=13
because the actual value of a=5 then
b=++a + ++a
b=(6) + (++6)= 12
b= (6) + (7)=13
then b=13
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / sasmita
Depending upon Compiler it will b 13 or 14.In Unix its 13.
| Is This Answer Correct ? | 4 Yes | 8 No |
Answer / pravesh
a=5
b=++a(6) + ++a(7)
b=13+1 when last addition is performed.
so, b=14
| Is This Answer Correct ? | 1 Yes | 18 No |
Write a program for finding factorial of a number.
Write a program to reverse a given number in c language?
Explain continue keyword in c
Program to swap the any two elements in an array containing N number of elements?
1 Answers Bosch, Glenwood, Ugam Solutions,
How does free() know explain how much memory to release?
I have written a pro*C program to fetch data from the cursor. where in i have used the concept of BULK FETCH.... each FETCH statement is taking lots of time to fetch specified number of rows at...
How are portions of a program disabled in demo versions?
int main() { int x = (2,3,4); int y = 9,10,11; printf("%d %d",x,y); } what would be the output?
n=7623 { temp=n/10; result=temp*10+ result; n=n/10 }
application of static variables in real time
a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above
what is compiler