#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

Table of Sudoku n*n

0 Answers  


writ a program to compare using strcmp VIVA and viva with its output.

0 Answers  


main() { int a[10]; printf("%d",*a+1-*a+3); }

2 Answers  


write a c program to print "Welcome" without using semicolon in the whole program ??

15 Answers   Infosys, TCS,


The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

0 Answers  






swap two integer variables without using a third temporary variable?

6 Answers   Persistent,


can you explain in brief what is "r+" mode in a file... i know that it si used to read and modify rhe existing content.... but explalanation about the file pointer in "r+" mode i wann to know???????????

2 Answers   Cognizant,


What is line in c preprocessor?

0 Answers  


Combinations of fibanocci prime series

0 Answers  


In C language what is a 'dangling pointer'?

0 Answers   Accenture,


Is c is a high level language?

0 Answers  


Why is the code below functioning. According to me it MUST NOT.

1 Answers  


Categories