intel实习笔试题二

#include <stdio.h>

struct test
{
int a;
int b;
};
struct test *fun1()
{
struct test t;
t.a = 1;
t.b = 2;
return &t;
}
void fun2(struct test *t1, struct test *t2)
{
printf("\nt1->a=%d t1->b=%d, t2->a=%d t2->b=%d\n",t1->a,t1->b,t2->a,t2->b);
return;
}
void main()
{
fun2(fun1(),fun1());

}

请根据以上代码回答如下几个问题.

1.sizeof(struct test) = ?

2. 函数调用顺序是否为:main->fun2->fun1->fun1->printf 。如果不是,请给出你认为正正确的顺序。

3.函数main由谁来调用?

4.程序中是否有错误,如果有,请纠正。

5.变量t存放在什么地方?


#include <stdio.h>

struct test
{
int a;
int *p;
};

void main()
{
struct test t;
int *p;
p = &t.a;
p[0] = 1;
p[1] = 2;
t.p = p;
t.p[1] = 3;
t.p[0] = 4;
}

请问以上程序在第几行会出现非法操作?为什么?


#include <stdio.h>

unsigned short v1, v2;
void main()
{
v1 = 0x8000;
v2 = 0x4000;
v1 = (v1 + 32768) >> 15 + 1;
v2 = (v2 + 32768) >> 15 + 1;
printf("v1=%d, v2=%d\n",v1,v2);
}

请写出输出结果?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值