【发布时间】:2012-08-21 10:24:14
【问题描述】:
void push(struct node** head_ref, int new_data)
{
/* allocate node */
struct node* new_node =
(struct node*) malloc(sizeof(struct node));
/* put in the data */
new_node->data = new_data;
/* link the old list off the new node */
new_node->next = (*head_ref);
/* move the head to point to the new node */
(*head_ref) = new_node;
}
如果我没记错的话,将括号放在指针上意味着调用函数?
如果这是真的,我真的不明白为什么 *head_ref 上有括号。
我喜欢在这段代码中解释一下为什么我需要在 *head_ref 上加上括号。
【问题讨论】: