【发布时间】:2013-10-24 19:35:06
【问题描述】:
我正在准备考试,我遇到了这个声明。我已经阅读了几本书和笔记,到目前为止我还没有遇到过这个,我什至不知道该怎么称呼它,所以我无法找到答案。
来了。
typedef struct {
unsigned a: 4;
unsigned b: 4;
} byte, *pByte;// what does *pbyte means here?
int main(){
pByte p = (pByte)x; // this is typecasting void pointer. how does it work with *pbyte
byte temp;
unsigned i;
for(i = 0u; i < n; i++) {
temp = p[i]; //again I have no idea why we suddenly have array
}
}
再次,如果我不知道一些基本的东西......好吧,我不知道,因为我还在学习:) 请帮帮我。谢谢。
【问题讨论】:
-
你真的应该read this question from beginning to end,尤其是第一个答案,这简直太棒了。
-
我还添加了 c 标签,因为 AFAIK 这个非常具体的“问题”对于两种语言都是一样的。
标签: c++ c arrays pointers structure