c++基础

1. 二叉树构建, 先找根

LRM, MLR后序先序都能先找根。
在加一个中序左右分

2. 位对齐, 2,4单位,变量不可分

struct
{
int a;
bool b;
short f;
short cr:5;
short cg:6;
short cb:5;
float s;
}A;
原则1: 一个变量 不能在2,4点截断。
原则2: 2,4可以分开用

3. 联合体

union
{
unsigned
char a[4];
unsigned
int b;
}A;
A.b
= 0x01020408;
求A.a[
0]<<5+A.a[1]<<3+A.a[2]<<1+A.a[0]的值

字符串0-n从最低位 指起。

所有变量都指向同一个空间。

posted on 2011-03-08 19:46  oleeceo  阅读(112)  评论(0)    收藏  举报

导航