- 博客(4)
- 收藏
- 关注
原创 bsearch和qsort
使用里的bsearch和qsort,比较函数的基本写法 1,确定被比较对象的顺序关系; 2,比较函数总用两个const void* 参数; 3,在函数开始时将参数正确转换到指向数组元素类型的指针; 4,在第一个参数大于、等于、小于第二个时分别返回1、0、-1; 5,注意使用方式。 -----------------------------------------------
2005-03-03 18:53:00 642
原创 Big-endian和Little-endian
简而言之:Big endian machine: It thinks the first byte it reads is the biggest.Little endian machine: It thinks the first byte it reads is the littlest.举个例子,从内存地址0x0000开始有以下数据 0x0000 0x12 0x0001
2005-03-03 18:52:00 441
原创 一个C函数,若处理器是Big_endian的,则返回0;若是Little_endian的,则返回1
int checkCPU(){UNION f{ int a; char b;}c;return (c.b == 1);}/*Another Program*/union aaa{int b;char c[2];}a;a.b=0x0001;return (a.c[0]==0x01);
2005-03-03 18:50:00 1743
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人