#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

How can you find the exact size of a data type in c?

0 Answers  


An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?

0 Answers   Aspire, Infogain,


What is pivot in c?

0 Answers  


who invented c

13 Answers   IBM,


what is c language.

3 Answers  


Why shouldn’t I start variable names with underscores?

0 Answers  


what is disadvantage of pointer in C

13 Answers   Tech Mahindra,


True or false: If you continuously increment a variable, it will become negative? 1) True 2) False 3) It depends on the variable type

7 Answers  


An array name contains base address of the array. Can we change the base address of the array?

4 Answers   NMIMS, Wipro,


How to write a program to receive an integer & find its octal equivalent by using for loop?

1 Answers   Google,


What are the 5 organizational structures?

0 Answers  


wat is the meaning of c?

9 Answers   CTS, IBM, Wipro,


Categories