Friday 22 March 2013

if(printf("%s\n",a))


    void main()
{
    int i;
    char a[]="\0";
    if(printf("%s\n",a))
         printf("Ok here \n");
    else
         printf("Forget it\n");
}
Answer:
 Ok here
Explanation:
Printf will return how many characters does it print. Hence printing a null character returns 1 which makes the if statement true, thus "Ok here" is printed.

Blog Author: Vijay Kumar

No comments:

Post a Comment