|
#include <stdio.h>
struct node {
int element;
struct node *next;
}
struct node *talloc()
{
return (struct node *) malloc(sizeof(struct node));
}
为何DEV CPP 编译时提示:
two or more data types declaration of 'talloc'
后面的程序如下
main()
{
struct node *head;
struct node *rear;
struct node *p;
head = talloc();
(*head).element = 1;
head->next = NULL;
rear = talloc();
(*rear).element = 2;
rear->next = NULL;
head->next = rear;
p=head;
while (p->next != NULL){
printf("%d\n",(*p).element);
p= p->next;
}
return 0;
} |
|