| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 327 人关注过本帖
标题:没有错误,为什么不能运行,请指教
只看楼主 加入收藏
班哥
Rank: 2
等 级:论坛游民
帖 子:7
专家分:13
注 册:2012-11-13
结帖率:0
收藏
已结贴  问题点数:5 回复次数:2 
没有错误,为什么不能运行,请指教
#include<stdio.h>
#include<malloc.h>
typedef struct node
{
    int data;
    struct node *lchild,*rchild;
}BT;
BT* createtree()
{
    BT *bt;
    char x;
    scanf("%c",&x);
    if(x=='0')bt=NULL;
    else
    {
        bt=(BT*)malloc(sizeof(BT));
        bt->data =x;
        bt->lchild =createtree();
        bt->rchild =createtree();
    }
     return bt;
}
int main()
{
    int i;
    while(1)
    {
        printf("\n\t\t\t* * * * * * * * * * * * * * * * * * * *");
        printf("\n\t\t\t       1.建树");
        printf("\n\t\t\t       2.");
        printf("\n\t\t\t       3.");
        printf("\n\t\t\t       4.");
        printf("\n\t\t\t       5.");
        printf("\n\t\t\t       6.");
        printf("\n\t\t\t       7.");
        printf("\n\t\t\t       8.");
        printf("\n\t\t\t       0.");
        printf("\n\t\t\t* * * * * * * * * * * * * * * * * * * *");
        printf("\n请输入你要进行的操作序号(0---9):");
        scanf("%d",i);
        switch(i)
        {
        case 1:createtree();break;
        case 2:break;
        case 3:break;
        case 4:break;
        case 5:break;
        case 6:break;
        }
    }
    return 0;
}
搜索更多相关主题的帖子: include return 
2012-12-09 15:16
yuccn
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:何方
等 级:版主
威 望:167
帖 子:6815
专家分:42393
注 册:2010-12-16
收藏
得分:3 

        scanf("%d",i);

这个改成
        scanf("%d",&i);
楼主太大意了

我行我乐
公众号:逻辑客栈
我的博客:
https://blog.yuccn. net
2012-12-09 15:53
思小宏
Rank: 1
等 级:新手上路
帖 子:9
专家分:6
注 册:2012-12-1
收藏
得分:3 
printf("\n请输入你要进行的操作序号(0---9):");
        scanf("%d",i);
        switch(i)
        {
        case 1:createtree();break;

你的那个scanf里的i没有加取地址符
2012-12-14 13:41
快速回复:没有错误,为什么不能运行,请指教
数据加载中...
 
   



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

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