- 论坛徽章:
- 0
|
#include <stdio.h>
#include <stdlib.h>
typedef int elemtype;
typedef struct node {
elemtype data;
struct node *lchild, *rchild;
}BinTNode, *BinTree;
void CreatBinTree (BinTree t)
{
char ch;
int ap = 64;
printf ("Enter %c :", ap ++);
scanf ("%c", &ch);
if (ch == ' ') t = 0;
else {
t = (BinTree) malloc (sizeof (BinTNode));
CreatBinTree (t -> lchild);
CreatBinTree (t -> rchild);
}
}
void preorder (BinTree t)
{
if (t){
printf (" %d ", t -> data);
preorder (t -> lchild);
preorder (t -> rchild);
}
}
void main ()
{
BinTree t;
CreatBinTree(&t);
printf ("Print Previous Order:\n");
preorder (t);
}
有这样的提示:
Warning bintree.c: 35 assignment of pointer to pointer to struct node to pointer to struct node
0 errors, 1 warning
我是用LCC3.8运行的。
再帮我看看,想要在输入数据的时候有提示的话,如何实现,好一些啊。
多谢。 |
|