1:多维数组参数
1 2 3 4 5 |
|
你之所以能在main()函数中看到char **argv
这样的参数,是因为argv是个指针数组(char *argv[]
)。这个表达式被编译器改写为指向数组第一个元素的指针,也就是一个指向指针的指针。如果argv参数事实上被声明为一个数组的数组(也就是char argv[10][15]),它将被编译器改写为char(*argv)[15](也就是一个字符数组指针),而不是char **argv.
2.char值范围(-128 ~ 127)
#include <string.h>
#include <stdio.h>
int main(void)
{
char *p = "012345";
char array[10] = {"56789"};
char i = 0x80;
int j = 0;
j=i;
printf("i is length = %d\n", i);
printf("i is length0 = 0x%x\n", i);
printf("j is length = %d\n", j);
printf("j is length0 = 0x%x\n", j);
printf("p is length = %d\n", sizeof(p));
printf("array is length = %d\n", sizeof(array));
}
输出:
i is length = -128 i is length0 = 0xffffff80 j is length = -128 j is length0 = 0xffffff80 p is length = 4 array is length = 10