c语言常见笔试题总结_第1页
c语言常见笔试题总结_第2页
c语言常见笔试题总结_第3页
c语言常见笔试题总结_第4页
c语言常见笔试题总结_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、【1 使用宏】1.1#ifdef NDEBUG#define TRACE(S S#else#define TRACE(S printf(“%s;n”, #S; S#endif问:以上TRACE(宏的作用是什么?1.2 #error的作用?1.3 定义一个宏,求出给定数组中的元素的个数#define NELEMENTS(array ?1.4 定义一个宏,求出给定结构中给定成员的偏移量#define OFFSET(structure, member ?【2 数据声明和定义】给定以下类型的变量a的定义式:a An integerb A pointer to an integerc A pointer

2、 to a pointer to an integerd An array of 10 integerse An array of 10 pointers to integersf A pointer to an array of 10 integersg A pointer to a function that takes an integer as an argument and returns an integerh An array of ten pointers to function s that take an integer argument and return an int

3、eger 【3 复杂类型(1】有如下表达式:char (*(*x(;请用文字描述x是什么。【4 复杂类型(2】jmp_buf的定义:typedef struct _jmp_bufREG_SET reg;int extra3; jmp_buf1;setjmp函数的原型:extern int setjmp (jmp_buf _env;问:调用setjmp时传递_env的内容,还是传递指针?【5 头文件】问:为什么标准头文件都有类似以下的结构?#ifndef _INCvxWorksh#define _INCvxWorksh#ifdef _cplusplusextern “C” #endif/*/#i

4、fdef _cplusplus#endif#endif /* _INCvxWorksh */【6 static关键字】请说出static关键字的3种用处:(1用于全局变量;(2用于局部变量;(3用于函数。/* file.c */static int a;int b;static int fn(static int x;int y;【7 const关键字】7.1 const关键字的意义是什么?7.2 解释以下的变量定义:const int a1;int const a2;const int *a3;int * const a4;int const * const a5;【8 volatile关键

5、字】8.1 volatile意义?例如volatile int *p;8.2 volatile能和const一起使用吗?例如volatile const int *p;【9 sizeof(】有以下定义:char *pmsg = “A”;char msg = “A”;char ch = A;问:sizeof(pmsg = ?sizeof(msg = ?sizeof(“A” = ?sizeof(ch = ?sizeof(A = ? (在C+中等于多少? void f(char param100/ sizeof(param = ?【10 字符串】有以下代码char *pmsg = “hello, world!”;strcpy(pmsg, “hi, there.”;试评论该代码。【11 混合运算】有以下代码:void foo(unsigned int a = 6;int b = -20;(a+b > 6 ? puts(“> 6 : puts(” < = 6; 请问调用foo(的输出?【12 内存访问】有以下代码:void fn(int a100;int *p;p = (int *(unsigned inta + 1;printf(“p=0x%xn”, *p;试评论以上代码。【13 C库函数】请说明以下函数的意义:v

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论