最近有点烦,好久没更新···

笔试注意

1. 类的大小:位对齐及虚函数指针地址。

2. 各类排序算法的复杂度和稳定性。

3. 次短路(网易笔试题)。http://www.cnblogs.com/XBWer/archive/2012/09/03/2669393.html。

4. A,B,C,D类地址。

5. http错误:

 

"400" : Bad Request
"401" : Unauthorized
"402" : Payment Required
"403" : Forbidden
"404" : Not Found
"405" : Method NotAllowed
"406" : Not Acceptable
"407" : Proxy AuthenticationRequired
"408" : Request Time-out
"409" : Conflict
"500" : Internal ServerError
"501" : Not Implemented
"502" : Bad Gateway
"503" : ServiceUnavailable
"504" : Gateway Time-out
"505" : HTTP Version notsupported

6. class a = b; 调用复制构造函数

7. template<typename t1, typename t2>
    int func(t1 a, t2 b=0)
    {
        return 1;
    }


   int main()
   {
        printf("%d",func(2.1));//无法匹配func(double);
   }

 

8. 大端小端模式:举一个例子,比如数字0x12 34 56 78在内存中的表示形式为:

1)大端模式:
低地址 -----------------> 高地址
0x12 | 0x34 | 0x56 | 0x78

2)小端模式:
低地址 ------------------> 高地址
0x78 | 0x56 | 0x34 | 0x12

可见,大端模式和字符串的存储模式类似。

 

#include <cstdio>
#include <iostream>
#include <cstring>

using namespace std;



    union{
        char a;
        char b;
        int d;
    }c;


int main()
{
    c.a = 'a';
    c.b = 'b';
    c.d = 0x61626364;
    printf("%c\n", c.a);
}


输出d;

 

 

 

posted @ 2013-10-09 21:31  little_hsu  阅读(89)  评论(0编辑  收藏  举报