笔试题_12_05_07

来源:互联网 发布:淘宝网毛衣女装 编辑:程序博客网 时间:2024/06/13 07:07

1. Find error

    char str1[10];

    char str2 = "0123456789"

    strcpy(str1, str2);

2. Find error

     char str1[10];

     if ( strlen(str2) <= 10 )

         strcpy(str1, str2);

3. IPC 的通讯方式 

4. C++构造函数和析构函数的调用顺序 

5. new 和 malloc 的区别

6. class 与 struct 的区别

7. Check output:

     unsigned int a = 1;

     int b = -2;

     (a+b) < 0 ? "<0":">0"

8. char *p = (char *) malloc (0), p 是NULL吗?

9. Find error

    int swap (int *a, int *b)

    {

        int *p;

        *p = *a;

        *a = *b;

        *b = *p;

    }

10. heap, stack 区别