判断大小端

 如图所示:

判断大小端

代码测试:

int check_sys(int a)
{
    int* p = &a;
    if (*p == 12345678)
        return 0;
    else
        return 1;
}
int main()
{
    int a = 0x12345678;
    int re = check_sys(a);
    if (a == 0)
    {
        cout << "big" << endl;
    }
    else
    {
        cout << "little" << endl;
    }
    system("pause");
    return 0;
}

判断大小端