typedef struct tre
{
int data;
struct tre *left;
struct tre *ringht;
}tre;
void tree(tre *t)
{
//printf("%d\n",t->data);
if (t->left!=NULL) {
tree(t->left);
}
//printf("%d\n",t->data);
if (t->ringht!=NULL) {
tree(t->ringht);
}
printf("%d\n",t->data);
}
int main(int argc, char * argv[]) {
tre t1={1,NULL,NULL};
tre t2={2,NULL,NULL};
tre t3={3,NULL,NULL};
tre t4={4,NULL,NULL};
tre *p1;
t1.left=&t2;
t1.ringht=&t3;
t2.ringht=&t4;
p1=&t1;
tree(p1);
return 0;
}
原文:http://www.cnblogs.com/a514875560/p/3991623.html