#include<stdio.h>
#include<stdlib.h>
#define Max 10
struct nodes
{char data;
int lc,rc;
}A[Max]={{'0',0,0},{'A',2,3},{'B',4,5},{'C',0,6},{'D',0,0},{'E',0,7},{'F',8,9},{'G',0,0},{'H',0,0},{'I',0,0}};
void postorder(int root)
{ if (A[root].lc!=0)
postorder(A[root].lc);
if (A[root].rc!=0)
postorder(A[root].rc);
printf("%c",A[root].data);
}
void main()
{int root=1;
printf("postorder\n");
postorder(root);
system("pause");
}
感觉你想写一棵二叉树,但是你却写了个数组?只看方法的话,root至始至终都没有变化。