没有合适的资源?快使用搜索试试~ 我知道了~
c语言笔试题.docx
0 下载量 71 浏览量
2023-08-04
09:09:41
上传
评论
收藏 20KB DOCX 举报
温馨提示
试读
16页
c语言笔试题.docx
资源推荐
资源详情
资源评论
c 语言笔试题
资料仅供参考
1.填空题
(1)、请写出下列代码的输出内容
#include <stdio.h>
int main(void)
{
int a,b,c,d;
a=10;
b=a++;
c=++a;
d=10*a++;
printf("b,c,d:%d,%d,%d",b,c,d);
return 0;
}
答:10,12,120
(2) char str[] = "\\\0";
char *p = str;
int n = 1000;
请计算
sizeof (str ) = ____________
sizeof ( p ) = ______________
sizeof ( n ) = ______________
3 4 4
(3) UCHAR *pucCharArray[10][10];
typedef union unRec
{
ULONG ulIndex;
USHORT usLevel[6];
UCHAR ucPos;
}REC_S;
REC_S stMax,*pstMax;
四字节对齐方式时: sizeof(pucCharArray) = ______, sizeof(stMax)=_______,
sizeof(pstMax)=________,sizeof(*pstMax)=________.
400 12 4 12
(4) struct BBB
{
资料仅供参考
long lNum;
char *pcName;
short sDate;
char cHa[2];
short sBa[6];
}*p;
p = 0x100000;
p + 0x1 = 0x____
(unsigned long)p + 0x1 = 0x______
(unsigned long *)p + 0x1 = 0x______
(char *)p + 0x1 = 0x______
100018 100001 100004 100001
( 5 ) struct
tagAAA
{
unsigned char ucId:1;
unsigned char ucPara0:2;
unsigned char ucState:6;
unsigned char ucTail:4;
资料仅供参考
unsigned char ucAvail;
unsigned char ucTail2:4;
unsigned long ulData;
}AAA_S;
问:AAA_S 在字节对齐分别为 1、4 的情况下,
占用的空间大小是多少?
9 12
(6)#pragma pack(4)/*编译选项,表示 4 字节
对齐*/
int main(int argc, char* argv[])
{
struct tagTest1
{
short a;
char d;
long b;
long c;
};
struct tagTest2
{
long b;
剩余15页未读,继续阅读
资源评论
zzzzl333
- 粉丝: 685
- 资源: 7万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功