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);
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步