摘要:在C++中,比如我们可以把一个结构体struct的地址赋给一个指针pointer 然后使用这个指针去访问这个结构体中的元素时,可以使用pointer member D-reference operator: -> 用来access a member through a pointer #includ
阅读全文
摘要:在C++中,我们通常使用typedef来实现type alias. 比如: #include <cstdint> //C standard int typedef uint32_t points_t; //points_t is alias of uint32_t typedef uint64_t
阅读全文
摘要:union指的是C语言的共用体(联合体) a union is a container of overlapping object 共用体它表示几个变量共用同一个内存位置, 在不同的时间保存不同的数据类型和不同长度的变量 union中,里面全部的共用体成员共用同一个内存空间, 而且特别重要的一点是:
阅读全文
摘要:C++中为了和语言兼容,保留了C语言中的struct关键字,并且进行了适当扩充. C语言 => struct只是包含成员变量,但不包括成员函数 C++中 => struct和class非常类似,既可以包括成员变量,又可以包括成员函数 也就是说C++中,struct和class基本上是可以通用的,只有
阅读全文