#include<stdio.h>
#include<stdlib.h>
/* Link list node */
struct node
{
int data;
struct node *next;
};
/* Function to reverse the linked list */
static void reverse(struct node** head_ref)
{
struct node *prev = NULL;
struct node *current = *head_ref;
struct node *next;
while (current != NULL)
{
next = current->next;
current->next = prev;
prev = current;
current = next;
}
*head_ref = prev;
}
- 反向函数中以 struct 开头的行是什么?他们是扩展原始结构还是创建原始结构指向的新结构?我真的不明白为什么原始结构没有名称
struct node *next;
和之间有区别struct node* next;
吗?