c语言中链表建立与处理中的问题

#include <stdio.h>
#include <malloc.h>
LL* creat();
LL* sort(LL *);
void print(LL *);
void main ()
{

    typedef struct Linklist
    {
        struct Linklist * pri=NULL;
        struct Linklist * next=NULL;
        int number;
    }LL;

    print(sort(creat()));
}

LL* creat()
{    
    while (1)

    {
       LL *new_one=NULL;
       LL *head=NULL;
       LL *p1=NULL;
        int tem=0;
        printf("请输入数值");
        scanf("%d",&tem);
        if(tem<0)
            return head;
        //建立链表中。。。。。
        int n=0;
        new_one =(LL *)malloc(sizeof(LL));
        //对节点建立关系
        if(p1)
        {
            p1->next=new_one;
            new_one->pri=p1;
        }
        P1=new_one;//保存上一个链表
        if(n=1)
        {
            head=new_one;
        }
        new_one->number=tem;

        
    }


}
LL* sort(LL *head)
{   
    int t;
    t=0;
    LL *p;
    if(head=NULL)
        printf("出错,请首先建立链表");
    //从小到大采用冒泡排序法
   for(    p=head;*p.next;p=*p.next)
       for(    p=head;*p.next;p=*p.next)
       {
    
        
           if(*p.number>*(*p.next).number)
        
           {
        
               t=*p.number;
               *p.number=*(*p.next).number;
               *(*p.next).number=t
           }
    
       }
       return head;

}
void print(LL *p)
{
    printf("从小到大输出");
    while(*p.next)
    {
        printf("d%",*p.number);
        p=*p.next;
    }
    printf("从大到小输出");
    while(*p.pri)
    {
        printf("%d",*p.number);
        p=*p.pri;
    }

}

以上是代码,错误是:
C:UsersJDesktoptext_2.c(3) : error C2143: syntax error : missing '{' before '*'
C:UsersJDesktoptext_2.c(4) : error C2143: syntax error : missing '{' before '*'
C:UsersJDesktoptext_2.c(4) : error C2143: syntax error : missing ')' before '*'
C:UsersJDesktoptext_2.c(4) : error C2143: syntax error : missing '{' before '*'
C:UsersJDesktoptext_2.c(4) : error C2059: syntax error : ')'
C:UsersJDesktoptext_2.c(4) : error C2059: syntax error : ';'
C:UsersJDesktoptext_2.c(5) : error C2143: syntax error : missing ')' before '*'
C:UsersJDesktoptext_2.c(5) : error C2143: syntax error : missing '{' before '*'
C:UsersJDesktoptext_2.c(5) : error C2059: syntax error : ')'
C:UsersJDesktoptext_2.c(5) : error C2059: syntax error : ';'
C:UsersJDesktoptext_2.c(11) : error C2143: syntax error : missing ';' before '='
C:UsersJDesktoptext_2.c(11) : error C2059: syntax error : '='
C:UsersJDesktoptext_2.c(16) : error C2143: syntax error : missing ')' before '('
C:UsersJDesktoptext_2.c(16) : error C2143: syntax error : missing ')' before '('
C:UsersJDesktoptext_2.c(16) : error C2091: function returns function
C:UsersJDesktoptext_2.c(16) : error C2091: function returns function
C:UsersJDesktoptext_2.c(16) : error C2059: syntax error : ')'
C:UsersJDesktoptext_2.c(16) : error C2059: syntax error : ')'
C:UsersJDesktoptext_2.c(17) : error C2059: syntax error : '}'
C:UsersJDesktoptext_2.c(53) : error C2143: syntax error : missing '{' before '*'
C:UsersJDesktoptext_2.c(53) : error C2143: syntax error : missing ')' before '*'
C:UsersJDesktoptext_2.c(53) : error C2143: syntax error : missing '{' before '*'
C:UsersJDesktoptext_2.c(53) : error C2059: syntax error : ')'
C:UsersJDesktoptext_2.c(54) : error C2054: expected '(' to follow 'head'
C:UsersJDesktoptext_2.c(79) : error C2143: syntax error : missing ')' before '*'
C:UsersJDesktoptext_2.c(79) : error C2143: syntax error : missing '{' before '*'
C:UsersJDesktoptext_2.c(79) : error C2059: syntax error : ')'
C:UsersJDesktoptext_2.c(80) : error C2054: expected '(' to follow 'p'
执行 cl.exe 时出错.

text_2.exe - 1 error(s), 0 warning(s)
编译器:vc++6.0
目的:建立一个链表,输入负数结束,实现升序和降序输出

阅读 2.6k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题