【发布时间】:2013-01-11 04:58:01
【问题描述】:
可能重复:
What are the barriers to understanding pointers and what can be done to overcome them?
我对c和指针真的不熟悉,我想了解这里发生了什么:
typedef struct {
int q[QUEUESIZE+1];
int first;
int last;
int count;
} queue;
init_queue(queue *q)
{
q->first = 0;
q->last = QUEUESIZE-1;
q->count = 0;
}
这样认为是否正确:q->first = 0 意味着如果一个分配给 '0' 地址某个值 'val',那么 *(q->first) 将返回 'val' ?
【问题讨论】:
-
*(q->first)甚至不是有效代码。你能更好地解释你的问题吗? -
是什么阻碍了您获得一本 C 教科书并花一些时间学习基础知识。我无法想象这不会在任何地方详细说明。