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

#include"stdio.h" #include"conio.h" void main() { int a; printf("\n enter a number:"); scanf("%c\n"); getch(); }

12 Answers   HCL,


what is meant by linking error? how can i solve it? if there is a linking error " unable to open file 'cos.obj'? then what should i do?

1 Answers  


full c programming error question based problem

3 Answers   HCL, TCS,


when i use cout or cin call & then either << or >> .....it shows declaration syntax error...what should i do? cout<<"anything"; int a; cin>>a; return 0;

2 Answers  


what are the techniques for reducing the fragility of a memory bug?

1 Answers  






Using string functions write a program that will accept the name of the capital as input value and will display the corresponding country. ------------------------ Capitals Countries ------------------------ Capitals Countries Ottawa Canada Moscow Russia Rome Italy I can't not get it to run properly

1 Answers   AMA,


Assume that the int variables i and j have been declared, and that n has been declared and initialized. Write code that causes a "triangle" of asterisks of size n to be output to the screen. Specifically, n lines should be printed out, the first consisting of a single asterisk, the second consisting of two asterisks, the third consistings of three, etc. The last line should consist of n asterisks. Thus, for example, if n has value 3, the output of your code should be * ** *** You should not output any space characters. Hint: Use a for loop nested inside another for loop.

2 Answers   HCL,


how to convert decimal to binary in c using while loop without using array

50 Answers   Apple, Aptech, Arwen Tech, BCS, C2D Software, CEC,


How to convert hexadecimal to binary using c language..

1 Answers   Bajaj, GAIL, Satyam, Zenqa,


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,


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

2 Answers   Access, Satyam,


Declaration of Cube Guys please help me.. Is this a right way to declare cube.? If i Compile it. It Says: Cube undeclared what should i do? Please help \thanks in advanced #include<stdio.h> #include<math.h> #include<conio.h> main( ) { float x,y; while(x++<10.0) { printf("Enter Number:"); scanf("%d", &x); y = cube(x); printf("%f %f %f \n", x,pow(x,2),y); cube(x); } { float x; float y; y = x*x*x; } getch(); return (y); }

2 Answers  


Categories