c++ 单引号"字符串" 用法
__int64 flag; //赋值超过4字节,编译错误 //flag = 'ABCDE'; //低于4字节,高位补 0 //flag = 'BCDE'; flag = 'A' << 24 + 'B' << 16 + 'C' << 8 + 'D'; //加运算 结果为 0 flag = 'A' << 24 | 'B' << 16 | 'C' << 8 | 'D'; //或运算的结果 等同 flag = 'ABCD'; flag <<= 32; flag |= 'EFHI'; cout << flag << endl; cout << std::hex << flag << endl; char * array = (char *)&flag; char buff[9] = { 0 }; strncpy(buff, array, sizeof flag); cout << buff << endl; getchar(); return 0; /* 输出结果 4702394921427290185 4142434445464849 IHFEDCBA */