1.
- char *str;
- scanf("%s", str);
2.想获取数组的长度,但一下只是获取整型指针a所占的内存空间
- void func(int a[])
- {
- printf("%d\n", sizeof(a));
- }
- int main()
- {
- int a[] = {0, 1, 2};
- func(a);
- }
正解:
- void func(int a[], int num)
- {
- }
- int main()
- {
- int a[] = {0, 1, 2};
- func(a, 3);
- }
3.
- int x = 2, y;
- int z = 3;
- x == (y = z);
- cout << x << endl;
答案:x = 2;
4.第二种复制方式好于第一种
- char ch = 'a';
- if (ch == 'A') {
- ...
- }
- char ch = 'a';
- if ('A' == ch) {
- ...
- }
5.
阅读(1269) | 评论(0) | 转发(0) |