avatar
几个C语言的题目# JobHunting - 待字闺中
b*7
1
1. what's the output? why?
#include
#include
int main()
{
while(1)
{
fprintf(stdout,"hello-std-out");
fprintf(stderr,"hello-std-err");
sleep(1);
}
return 0;
}
2. what's the output?
#include
int main()
{
float a = 12.5;
printf("%d\n", a);
printf("%d\n", (int)a);
printf("%d\n", *(int *)&a);
return 0;
}
3. can it be built? if yes, what's the result?
file1.c:
int arr[80];
file2.c:
extern int *arr;
int main()
{
arr[1] = 100;
printf("%d\n", arr[1]);
return 0;
}
4. what's the output?
#include
int main()
{
int i;
i = 10;
printf("i : %d\n",i);
printf("sizeof(i++) is: %d\n",sizeof(i++));
printf("i : %d\n",i);
return 0;
}
5. what's the output?
#include
int main()
{
char dummy[80];
printf("Enter a string:\n");
scanf("%[^r]",dummy);
printf("%s\n",dummy);
return 0;
}
6. which are valid?
int (*pf)(void);
int f(void)
{
pf = &f;
pf = ***f;
pf();
(****pf)();
(***************f)();
}
7. what does it return?
return ((1 - sizeof(int)) >> 32);
avatar
h*n
2
这是哪个厂的题.感觉这种题是专门用来打击人的.

【在 b*******7 的大作中提到】
: 1. what's the output? why?
: #include
: #include
: int main()
: {
: while(1)
: {
: fprintf(stdout,"hello-std-out");
: fprintf(stderr,"hello-std-err");
: sleep(1);

avatar
c*a
3
太恶心了
让我想起intro cs
avatar
f*t
4
只有BB会出这种恶心题吧
avatar
h*s
5
第七题应该是跟实现相关的吧
有的符号位右移有的不右移?

【在 b*******7 的大作中提到】
: 1. what's the output? why?
: #include
: #include
: int main()
: {
: while(1)
: {
: fprintf(stdout,"hello-std-out");
: fprintf(stderr,"hello-std-err");
: sleep(1);

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。