func_p p
p代表什么意思?
答:
定义一个函数指针类型(注意是类型)p,指向一个函数,该函数接受一个参数int *型,返回int。也就是说,有这样的定义:
typedef int (*p) (int );
int foo(int a); //声明,foo在其他地方定义。
可以这样使用:p pf = foo; //&foo也可以,一个意思。
2.int(*a[10])(int) a代表什么意思?
答:
3.char str[]="GE";
char *str2 = str;
sizeof(str)=? sizeof(str2)=?
答:sizeof(str)=2 sizeof(str2)=4
4.有关malloc的程序判断,具体的给忘了,就是看一下字符串空间的分配。
5.关键字volatile的含义,在程序设计过程中的应用?
6.const int *p1;
int const *p2;
int *const p3;
答:const int *p1; // 指向 const int的指针
int const *p2; // 指向 const int的指针,与const int* p1等价
int *const p3;// 指向int的const指针
7.int a = -1;
unsigned int b = 2;
那么a+b>a?为什么?a+b>b?为什么?
转换为最大表示类型进行运算,unsigned int 最大可表示2^32 - 1,int最大可表示2^31-1
a+b>a?为false,不大,a+b 结果unsigned int型1,1〉65535?
a+b>b?为false,不大,a+b 结果unsigned int型1,1〉2?