What will be the output of the following C code?
#include <stdio.h>
int main()
{
if (7 & 8)
printf(“Honesty”);
if ((~7 & 0x000f) == 8)
printf(“is the best policy\n”);
}
a) Honesty is the best policy
b) Honesty
c) is the best policy
d) No output
Answer: c
Related Posts
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 1, y = 0;
x &&= y;
printf(“%d\n”, x);
}What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 2, y = 2;
x /= x / y;
printf(“%d\n”, x);
return 0;
}What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 2, y = 1;
x *= x + y;
printf(“%d\n”, x);
return 0;
}What will be the output of the following C code snippet?
#include <stdio.h>
void main()
{
unsigned int x = -5;
printf(“%d”, x);
}What will be the output of the following C code snippet?
#include <stdio.h>
void main()
{
1 < 2 ? return 1: return 2;
}What will be the output of the following C code?
#include <stdio.h>
void main()
{
char a = ‘a’;
int x = (a % 10)++;
printf(“%d\n”, x);
}What will be the output of the following C code?
#include <stdio.h>
void main()
{
int k = 8;
int x = 0 == 1 && k++;
printf(“%d%d\n”, x, k);
}
Join The Discussion