1. What will be the output of the following code ?
#include <stdio.h>
int main()
{
int i = 3, j = 4;
i ? i++ : ++j;
printf("i=%d, j=%d \n", i, j);
}
int main()
{
int i = 3, j = 4;
i ? i++ : ++j;
printf("i=%d, j=%d \n", i, j);
}
2. What will be the output of the following C code ?
#include <stdio.h>
#define product(x) (x*x)
int main()
{
int i = 3, j, k;
j = product(i++);
k = product(++i);
printf("j=%d, k=%d \n", j, k);
return 0;
}
#define product(x) (x*x)
int main()
{
int i = 3, j, k;
j = product(i++);
k = product(++i);
printf("j=%d, k=%d \n", j, k);
return 0;
}
3. What will be the output of the following code?
#include <stdio.h>
int main()
{
int i = 5, j = 3;
!i && ++j;
printf("i=%d, j=%d \n", i, j);
}
int main()
{
int i = 5, j = 3;
!i && ++j;
printf("i=%d, j=%d \n", i, j);
}