标题:我不知道怎么改,各位大侠帮我!
取消只看楼主
zyx1989
Rank: 1
等 级:新手上路
帖 子:86
专家分:2
注 册:2011-9-17
结帖率:83.33%
已结贴  问题点数:10 回复次数:1 
我不知道怎么改,各位大侠帮我!
#include<stdio.h>
#include<malloc.h>
struct student
{
    int num;
    struct student *link;
}stud;
  
 creat(int n)
{
    struct student *h,*p;
    int i;
    if((h=(stud *)malloc(sizeof(stud)))==NULL);
    {
        printf("not enough memory!");
        return(0);
    }
    h=NULL;
    for(i=0;i<=n;i++)
    {
         p=h;
         
        if((p=(stud *)malloc(sizeof(stud)))==NULL);

            
            
        {
            printf("内存不足!");
            return(0);
        }
        scanf("%d",&p->num);
        p->link=h;
        h=p;
    }
    }
    void main()
    {
        struct student *h;
        h=(struct student *)creat(4);
    }
   
搜索更多相关主题的帖子: 内存 include memory return 
2011-09-24 09:53
zyx1989
Rank: 1
等 级:新手上路
帖 子:86
专家分:2
注 册:2011-9-17
得分:0 
原来这样,明白了
2011-09-24 18:14



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-350740-1-1.html




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

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