Explain the output of following?

#include<stdio.h>
void main()
{
char ch;
if((ch=printf(1234))
printf("A");
else
printf("B");
}

Answer is B : But i don't know what value is assigned to ch and what happens to printf(1234)
Did you forget "" around 1234 ? The argument of printf is a pointer and when you pass a random integer as a pointer to the string that you want printed, it should crash.
For any information on printf, see http://www.cplusplus.com/reference/clibrary/cstdio/printf/
Topic archived. No new replies allowed.