- 论坛徽章:
- 0
|
#include <stdio.h>
typedef struct node {
int data;
struct node *next;
}linknode, *link;
void main()
{
link a, b,n,h;
h = (linknode *)malloc(sizeof(linknode));
h->next = NULL;
a=h;
135: for(int i = 0; i < 5; i++)
136: {
n = (linknode *)malloc(sizeof(linknode));
n->data = 1;
n->next = NULL;
a->next = n;
a=a->next;
}
a=h->next;
for(a=h->next; a!=NULL; a=a->next)
{
printf("%d",a->data);
}
}
》cl un.c 编译出错如下(我用的是vs2005的cl编译器)
un.c
un.c(135) : error C2143: syntax error : missing ';' before 'type'
un.c(135) : error C2143: syntax error : missing ';' before 'type'
un.c(135) : error C2143: syntax error : missing ')' before 'type'
un.c(135) : error C2143: syntax error : missing ';' before 'type'
un.c(135) : error C2065: 'i' : undeclared identifier
un.c(135) : warning C4552: '<' : operator has no effect; expected operator with
side-effect
un.c(135) : error C2059: syntax error : ')'
un.c(136) : error C2143: syntax error : missing ';' before '{'
写个for怎么错了呢? |
|