|
#include <stdio.h>
struct node {
int element;
struct node * next;
}
struct node * talloc ()
{
return (struct node *) malloc (sizeof (struct node));
}
Why does DEV CPP prompt when compiling:
two or more data types declaration of 'talloc'
The following procedure is as follows
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;
} |
|