#include<stdio.h>
#include<conio.h>
struct mynew
{
int a;
struct mynew *p;
};
struct mynew *creat(int n)
{
struct mynew *head,*pf,*pb;
int i;
for(i=0;i<n;i++)
{
pb=(struct mynew *)malloc(sizeof(struct mynew));
printf("please input a number:");
scnaf("%d",&pb->a);
if(i==0) pf=head=pb;
else pf->p=pb;
pb->p=NULL;
pf=pb;
}
return(head);
}
void main()
{
int n;
struct mynew *ptr;
printf("please input how many structs do your want to creat:");
scanf("%d",&n);
ptr=*creat(n);
for(;;)
{
printf("%d",ptr->a);
ptr++;
if(ptr->p==NULL) break;
}
getch();
}
RT:一个创建链表,输入数据,然后显示出来的链表,可为何编译到"ptr=*creat(n);"这一句的时候就出错了?系统说是incompatible types in assignment……不知道哪里不匹配了……求解,谢谢了~~