-
Which of the following is the correct output for the program given below ?
#include <studio.h>
int main ( )
{
char ch;
if ((ch = printf ("")));
printf ("I am inside if \n");
else
printf ("I am inside else\n");
return 0;
}
-
- I am inside if
- I am inside else
- random value
- No Output
Correct Option: B
printf("")
returns the number of characters successfully printed. So the condition
if(ch = printf(""))
fails as ch is set to 0. Hence, the else clause is getting executed.