急!!急!!!请大家帮小弟看一下这个C程序哪里出了问题?

来源:百度知道 编辑:UC知道 时间:2024/05/22 16:47:07
程序如下,运行的时候不能跳出输入的循环,小兄弟初学C程序,不知道哪里出了错,请大家帮忙分析,指点上弟一下,谢谢!!!
#include<stdio.h>
#include<stdlib.h>
#define N 8
typedef struct list
{
int data;
struct list *next;
} SLIST;
void fun(SLIST *h,int x)
{
SLIST *p,*q,*s;
s=(SLIST *)malloc(sizeof(SLIST));
s->data=x;
q=h;
p=h->next;
while(p!=NULL&&x>p->data)
{ q=p;
p=p->next;
}
s->next=p;
q->next=s;
}
SLIST *creatlist(int *a)
{
SLIST *h,*p,*q;
int i;
h=p=(SLIST *)malloc(sizeof(SLIST));
for(i=0;i<N;i++)
{
q=(SLIST *)malloc(sizeof(SLIST));
q->data=a[i];
p->next=q;
p=q;
}
p->next=0;
return h;
}
void outlist(SLIST *h)是不是这个函数的循环哪里出了问题?
{
SLIST *p;
p=h->next;
if(p==NULL)
printf("\nThe list is NULL!\n");
else

好长
do {printf("->%d",p->data);p=p->next;} while(p=!NULL);
error C2440: “=”: 无法从“bool”转换为“SLIST *”

又是链表的问题
从整型转换为指针类型要求 reinterpret_cast、C 样式转换或函数样式转换