[实战演练]格科微电子软件类笔试题目
摘要:1. 写一个C函数,判断计算机系统是大端模式(big endian)还是小端模式(small endian)。答案参考自:http://blog.csdn.net/ce123_zhouwei/article/details/6971544第一种思路:short int 强制转换为char,看转换的结果。代码如下:void test1(){ short int x; char x0, x1; x = 0x1122; x0 = ((char*)&x)[0];//低地址 x1 = ((char*)&x)[1];//高地址 if(0x11 == x0) { ...
阅读全文
posted @ 2013-11-14 17:38