Determine Output:
void main()
{
int i;
char a[]="�";
if(printf("%sn", a))
printf("Ok here n");
else
printf("Forget itn");
}
void main()
{
int i;
char a[]="�";
if(printf("%sn", a))
printf("Ok here n");
else
printf("Forget itn");
}
A. Ok here
B. Forget it
C. Error
D. None of These
Answer: Option A
Solution(By Examveda Team)
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.
Join The Discussion
Comments ( 1 )
Related Questions on C Miscellaneous
Determine output:
void main()
{
int const *p=5;
printf("%d", ++(*p));
}
A. 6
B. 5
C. Garbage Value
D. Compiler Error
A. mmm nnn aaa
B. mmmm nnnn aaaa
C. Compiler Error
D. None of These
A. I hate Examveda
B. I love Examveda
C. Error
D. None of These
Determine Output:
void main()
{
static int var = 5;
printf("%d ", var--);
if(var)
main();
}
A. 5 5 5 5 5
B. 5 4 3 2 1
C. Infinite Loop
D. None of These
This is Correct Answer: �nOk here n
Please Correct!