int i;
i=2;
i++;
if(i=4)
{
printf(i=4);
}
else
{
printf(i=3);
}
output of the program ?

Answers were Sorted based on User's Feedback



int i; i=2; i++; if(i=4) { printf(i=4); } else { ..

Answer / sukant

The syntax for the if statement is also not correct..
The conditional assignment includes two == rather than a single =...
so,, the if statement wont consider that as a conditional statement and come out of it..
And, it will give an error in the printf(i=3); as the syntax is not apt.

Is This Answer Correct ?    0 Yes 0 No

int i; i=2; i++; if(i=4) { printf(i=4); } else { ..

Answer / khaja

output is 3

Is This Answer Correct ?    1 Yes 2 No

int i; i=2; i++; if(i=4) { printf(i=4); } else { ..

Answer / fwfwgq

It will give segmentation fault in linux

Is This Answer Correct ?    6 Yes 8 No

int i; i=2; i++; if(i=4) { printf(i=4); } else { ..

Answer / gowtham

answer is three

Is This Answer Correct ?    1 Yes 6 No

int i; i=2; i++; if(i=4) { printf(i=4); } else { ..

Answer / fazlur

the output will b 4.

Is This Answer Correct ?    6 Yes 18 No

Post New Answer

More C Interview Questions

Is struct oop?

0 Answers  


What is array in C

0 Answers  


Result of the following program is main() { int i=0; for(i=0;i<20;i++) { switch(i) case 0:i+=5; case 1:i+=2; case 5:i+=5; default i+=4; break;} printf("%d,",i); } } a)0,5,9,13,17 b)5,9,13,17 c)12,17,22 d)16,21 e)syntax error

8 Answers   IBM,


what are the facialities provided by you after the selection of the student.

0 Answers   TCS,


what is foreign key in c language?

1 Answers   ADP,






void main() { //char ch; unsigned char ch; clrscr(); for(ch =0;ch<= 127; ch++) printf(" %c= %d \t ", ch, ch); } output?

4 Answers   Groupon,


How can you tell whether two strings are the same?

0 Answers  


what is difference between c and c++

4 Answers  


Explain how can I convert a number to a string?

0 Answers  


what are the stoge class in C and tel the scope and life time of it?

2 Answers   Tech Mahindra,


what does ‘#include’ mean?

1 Answers   TCS,


Differentiate between a for loop and a while loop? What are it uses?

0 Answers   TISL,


Categories