出现error C2660: 'create' : function does not take 0 parameters怎么解决呢
#include <stdio.h>#include <stdlib.h>
struct list
{
int data;
struct list* next;
};
struct list* create(int a[])
{
struct list *head = NULL, *p, *q;
int i;
head = p = (struct list*)malloc(sizeof(struct list));
p->data = 0;
for (i = 1; i <= 10; i++)
{
q = (struct list*)malloc(sizeof(struct list));
q->data =a[i] ;
p->next = q;
p = q;
}
p->next = NULL;
return head;
}
void print(struct list* head)
{
struct list* p = head;
if (!head) puts("NULL");
while (p)
{
printf("%d ", p->data);
p = p->next;
}
}
struct list* reverse(struct list* head)
{
struct list *p = head, *q, *t;
if (!head) return NULL;
q = p->next;
while (q)
{
t = q->next;
q->next = p;
p = q;
q = t;
}
head->next = NULL;
head = p;
return head;
}
int main(void)
{
struct list* head;
head = create();
head = reverse(head);
print(head);
return 0;
}