鱼C论坛

 找回密码
 立即注册
查看: 4556|回复: 2

链表建立关于错误c2562:“无效”函数返回值问题

[复制链接]
发表于 2011-11-4 21:52:20 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
        struct student * build();//建立链表
        {
                struct student * p,* listp,* listhead;
                int i=1;
                listhead=NULL;
                if((p=(struct student * )malloc(sizeof(struct student)))==NULL)
                {printf("申请内存失败!请重试!"); return ;}
                do
                {
                if(listhead==NULL)
                        listhead=p;
                else
                        listp->next=p;
                        listp=p;
                        listp->next=NULL;       
                        printf("请输入第%d个学生的学号(-1结束输入):",i);
                        scanf("%d",&listp->xuehao);
                        printf("请输入第%d个学生的名字(字母):",i);
                        scanf("%s",listp->name);
                        printf("请输入第%d个学生的成绩:",i);
                        scanf("%d",&listp->chengji);
                        i++;
                }
                while(listp->xuehao!=-1);
        return listhead;
        }
小甲鱼最新课程 -> https://ilovefishc.com
 楼主| 发表于 2011-11-4 21:54:36 | 显示全部楼层
编译时老提示
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(141) : error C2562: 'main' : 'void' function returning a value
        C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(17) : see declaration of 'main'
不知道那里有问题!望各位高手指教!
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2011-11-5 21:47:19 | 显示全部楼层
主函数都没有。。
小甲鱼最新课程 -> https://ilovefishc.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-11-9 07:09

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表