| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 677 人关注过本帖
标题:我不知道怎么改,各位大侠帮我!
取消只看楼主 加入收藏
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
快速回复:我不知道怎么改,各位大侠帮我!
数据加载中...
 
   



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

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