C Programming :: String
Home > C Programming > String > Discussion
6. #include
void main()
{
int i;
char a[]="\0";
if(printf("%s\n",a))
printf("Ok Done \n");
else
printf("Forget it\n");
}
void main()
{
int i;
char a[]="\0";
if(printf("%s\n",a))
printf("Ok Done \n");
else
printf("Forget it\n");
}
Answer: Option B
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
Done" will be printed.
No Discussion on this question yet!