#include<conio.h>
#include<stdio.h>
void main()
{
int i;
if(1,0,2,3)
{
printf("if");
}
else
{
printf("else");
}
getch();
}
Can any body tell the answer of this question with explanation?

Answers were Sorted based on User's Feedback



#include<conio.h> #include<stdio.h> void main() { int i; if(1,0,2,3) { printf(&qu..

Answer / shyamkumar1221

the question might be like this
#include<conio.h>
#include<stdio.h>
void main()
{
int i=1;
intj=0,k=2,l=3;
if(i,j,k,l)
{
printf("if");
}
else
{
printf("else");
}
getch();
}
the output would be if
since in the if ()we are using comma operator.the precedence
is left to right...since in the if the we get output as 3
which is non zero.the if statement is true and if statement
will be printed

Is This Answer Correct ?    11 Yes 1 No

#include<conio.h> #include<stdio.h> void main() { int i; if(1,0,2,3) { printf(&qu..

Answer / guest

yhaa... it will print if....... okay...


why u know.... because in if condition u r not checking any
conditions... thatis why,,,,,

Is This Answer Correct ?    0 Yes 1 No

#include<conio.h> #include<stdio.h> void main() { int i; if(1,0,2,3) { printf(&qu..

Answer / prateek songara

By default "i" will posses the value 2 bcoz of "int" and when it moves to "if" it will check all the values matches with its value (1,0,2,3) and if he gets the match then it will print the "if" ..else it will print the "else"..........hope you got the answer now.

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More C Interview Questions

What is the general form of a C program?

0 Answers  


a linear linked list such that the link field of its last node points to the first node instead of containing NULL a) linked list b) circular linked list c) sequential linked list d) none

0 Answers  


how to write palindrome program?

3 Answers  


can you change name of main()?how?

3 Answers   HCL, Siemens,


Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above

0 Answers  






Does free set pointer to null?

0 Answers  


Define function pointers?

1 Answers  


Does c have an equivalent to pascals with statement?

0 Answers  


Why is structure important for a child?

0 Answers  


in case any function return float value we must declare a) the function must be declared as 'float' in main() as well b) the function automatically returned float values c) function before declared 'float' keyword d) all the above

0 Answers  


A text file that contains declarations used by a group of functions,programs,or users a) executable file b) header file c) obj file d) .cfile

0 Answers  


What 'lex' does?

0 Answers   Tech Mahindra,


Categories