求各位大哥解决,编写的一个链表编译没通过
声明部分:#ifndef _LIST_
#define _LIST_
#include<stdio.h>
#include<stdlib.h>
#include<strings.h>
typedef int data_t;
typedef struct node{
data_t data;
struct node *next;
}NODE;
NODE *creat_node(data_t data);
int isnull( NODE *head);
void insert( NODE *head, data_t data, int n);
void _delete( NODE *head, data_t data);
void show_link( NODE *head);
#endif
函数体部分:
#include "blink.c"
NODE *creat_node(data_t data)
{
NODE *link_node = (NODE *)malloc(sizeof(NODE));
if( NULL == link_node )
exit(-1);
link_node->data = data;
link_node->next = NULL;
return link_node;
}
int isnull(NODE *head)
{
return head->next == NULL ? 1 : 0;
}
void insert(NODE *head, data_t data, int n)
{
int i;
NODE *link_node = creat_node(data);
for( i=1; i<n; i++)
{
head = head->next;
}
link_node->next = head-next;
head->next = link_node;
}
void _delete(NODE *head, data_t data)
{
NODE *p =NULL;
while( head->next )
{
p = head;
head = head->next;
if( data == head->data )
{
p->next = head->next;
free(head);
}
}
}
void show_link(NODE *head)
{
while( head->next )
{
head = head->next;
printf("%d", head->data);
}
printf("\n");
}
main函数:
#include "blink.h"
void main()
{
int j = 0;
int i = 10;
NODE *head = creat_node(-1);
while( i-- )
{
j++;
insert(head, i, j);
}
show_link(head);
}
编译显示:
blink.c:3: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
blink.c:13: error: expected ‘)’ before ‘*’ token
blink.c:18: error: expected ‘)’ before ‘*’ token
blink.c:30: error: expected ‘)’ before ‘*’ token
blink.c:45: error: expected ‘)’ before ‘*’ token
In file included from blink.c:1,
from blink.c:1,
from blink.c:1,
from blink.c:1,
from blink.c:1,
from blink.c:1,
from blink.c:1,
from blink.c:1,
from blink.c:1,
from blink.c:1,
from blink.c:1: