|
10鱼币
请问下面这两种传法,传的都是地址,差别具体在哪呢
- 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;
- }
复制代码
- Node* push(Node* head,int x){
- list number = (list)malloc(sizeof(struct LISTnode));
- number->x = x;
- number->next = head;
- head = number;
- return head;
- }
复制代码 |
|