void main()
{
int i=5;
printf("%d",i+++++i);
}

Answers were Sorted based on User's Feedback



void main() { int i=5; printf("%d",i+++++i); }..

Answer / nagarajan

If it is i++ + ++i the output will be 12 because
i++ =6
++1 =6

6+6=12

but in this case continuous five plus will show error .

compiler cannot identify operands there must be a space in between

Is This Answer Correct ?    55 Yes 21 No

void main() { int i=5; printf("%d",i+++++i); }..

Answer / junaid

well if you write all 5+ without space then it will give an error because compiler will not recognize it
you can write i++ + ++i or ++i + i++
answer in both statements will be 12

Is This Answer Correct ?    16 Yes 7 No

void main() { int i=5; printf("%d",i+++++i); }..

Answer / m

oly error wil be produced

Is This Answer Correct ?    9 Yes 2 No

void main() { int i=5; printf("%d",i+++++i); }..

Answer / harshawardhan

all functions pass the value from right to left and printf()
is one function therefore
i++ + ++i
in this siquence first solve the ++i and then solve the i++
first incrment by one i.e. 6 and then it solve i++ i.e. 5

printf("%d",i++ + ++i);
printf("%d",i++ + 6);
printf("%d",6 + 6);
printf("%d",12);


And therefoe output is:-

12

Is This Answer Correct ?    13 Yes 9 No

void main() { int i=5; printf("%d",i+++++i); }..

Answer / sadfasd

hmmm

Is This Answer Correct ?    2 Yes 2 No

void main() { int i=5; printf("%d",i+++++i); }..

Answer / gaurav tyagi

first of all
i want to say every one plz write ans if you are fully confident otherwise run it
///in this program a error is occurs because compiler not recognize the code <i am run this one>

Is This Answer Correct ?    3 Yes 3 No

void main() { int i=5; printf("%d",i+++++i); }..

Answer / srinivas

printf allways it will work from right to left so first
++i=6 after that i++ also 6 so 6+6=12 ..

Is This Answer Correct ?    9 Yes 10 No

void main() { int i=5; printf("%d",i+++++i); }..

Answer / vns

Increment operator(++i) only increases i value. At first ++i, i value becomes 6. Then there's another ++i, now i value is 7. both increment operations are evaluated since it has higher precedence than addition. So (++i) +(++i)= (i)+(i)= 7+7=14.

compile and run the program and you will get 14.

Is This Answer Correct ?    1 Yes 2 No

void main() { int i=5; printf("%d",i+++++i); }..

Answer / rohit surutkar

error

Is This Answer Correct ?    2 Yes 4 No

void main() { int i=5; printf("%d",i+++++i); }..

Answer / taruna

plzzz explain this ...why can't its answer be 12..???
plzz give proper explaination....waitin!!!

Is This Answer Correct ?    4 Yes 7 No

Post New Answer

More C C++ Errors Interview Questions

what is exceptions?

5 Answers   HCL, Wipro,


#include<>stdio.h> #include<>conio.h> { printf("hello"); void main() getch(); } what the out put of this program and why ......plz clear my answer

10 Answers   Wipro,


How to reverse a linked list without using array & -1? Thank you.

2 Answers   Access, Satyam,


Write a c-programe that input one number of four digits and find digits sum?

2 Answers  


Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have already been declared, use a do...while loop to compute the sum of the cubes of the first n whole numbers, and store this value in total . Thus if n equals 4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into total . Use no variables other than n , k , and total .

3 Answers  






What is the code for following o/p * * * * * * * * * * * * * * * *

1 Answers  


what is the large sustained error signal that eventually cause the controller output to drive to its limit

1 Answers   TCS,


Given that two int variables, total and amount , have been declared, write a sequence of statements that: initializes total to 0 reads three values into amount , one at a time. After each value is read in to amount , it is added to the value in total (that is, total is incremented by the value in amount ). Instructor's notes: If you use a loop, it must be a for loop. And if you use a loop control variable for counting, you must declare it.

1 Answers   Google,


errors are known as?

3 Answers   EX, State Bank Of India SBI,


void main() { int i=5,y=3,z=2,ans; clrscr(); printf("%d",++i + --z + i++ + --i * ++y); i=5,y=3,z=2; ans=++i + --z + i++ + --i * ++y; printf("\n%d",ans); getch(); } Its output is 37 and 31.... Please explain me why its different How it works.....

2 Answers  


Given that two int variables, total and amount, have been declared, write a loop that reads integers into amount and adds all the non-negative values into total. The loop terminates when a value less than 0 is read into amount. Don't forget to initialize total to 0. Instructor's notes: This problem requires either a while or a do-while loop.

3 Answers  


Write a program to accept two strings of Odd lengths. Then take all odd characters from one string and even characters from the other and concatenate and produce a string.

1 Answers  


Categories