| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1803 人关注过本帖
标题:请各位大神帮帮忙,编译器提示的错误为 `main' undeclared (first use this ...
取消只看楼主 加入收藏
孤单忧怜
Rank: 1
等 级:新手上路
帖 子:5
专家分:7
注 册:2015-3-9
结帖率:0
收藏
已结贴  问题点数:20 回复次数:0 
请各位大神帮帮忙,编译器提示的错误为 `main' undeclared (first use this function) 和让在主函数main()直接加;
#include "stdlib.h"
#include "stdio.h"
typedef int ElemType;
typedef struct node{
        ElemType data;
        struct node *next;
        }LNode,*LinkList;
LinkList CreatLinkList(int n){
         /*建立一个长度为n的链表*/
         LinkList p,r,list=NULL;
         ElemType e;
         int i;
         for(i=1;i<=n;i++)
         {
                          scanf("%d ",&e);
                          p=(LinkList)malloc(sizeof(LNode));
                          p->data=e;
                          p->next=NULL;
                          if(!list)
                          list=p;
                          else
                          r->next=p;
                          r=p;
                          }
                          return list;
         }
void insertList(LinkList *list,LinkList q,ElemType e){
     LinkList p;
     p=(LinkList)malloc(sizeof(LNode));
     p->data=e;
     if(!*list){
                *list=p;
                p->next=NULL;
                }
                else{
                     p->next=q->next;
                     q->next=p;
                     }
                     }
                     void delLink(LinkList *list,LinkList q){
                          LinkList r;
                          if(q==*list){
                          *list=q->next;
                          free(q);
                          }
                          else{
                               for(r=*list;r->next!=q;r=r->next){
                               if(r->next!=NULL){
                                                 r->next=q->next;
                                                 free(q);
                                                 }
                               }
                               }
void destoryLinkList(LinkList *list);
{
                                    LinkList p,q;
                                    p=*list;
                                    while(p){
                                             q=p->next;
                                             free(p);
                                             p=q;
                                             }
                                             *list=NULL;
                                             }
 main(){
      int e,i;
      LinkList l,p;
      q=l=CreatLinkList(l);
      scanf("%d",&e);
      while(e)
      {
              insertList(&l,q,e);
              q=q->next;
              scanf("%d",&e);
              }
              q=1;
              printf("The content of the linklist\n" );
              q=q-next;
              while(q){
              printf("%d ",q->data);
              q=q->next;
              }
              q=1;
              printf("\nDelete the fifth element\n");
              for(i=0;i<4;i++)
              {
                              q=q->next;
              }
              delLink(&l,q);
              q=l;
              while(q)
              {
                      printf("%d ",q->data);
                      q=q->next;
              }
              destoryLinkList(&l);
              getche();
              }
              }
搜索更多相关主题的帖子: function include 编译器 
2015-03-16 20:41
快速回复:请各位大神帮帮忙,编译器提示的错误为 `main' undeclared (first use ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.041306 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved