1 void PrePrintOrTree(struct TreeNode* root, void (*WorkPrint)(double)){
2 struct TreeNode* index = root;
3 if (root == NULL){
4 return;
5 }
6 PrePrintOrTree(root->lchild,WorkPrint);
7 (*WorkPrint)(root->value);
8 PrePrintOrTree(root->rchild,WorkPrint);
9 }
10 void WorkPrint(double value){
11 printf("%.3f ",value);
12 }
2 struct TreeNode* index = root;
3 if (root == NULL){
4 return;
5 }
6 PrePrintOrTree(root->lchild,WorkPrint);
7 (*WorkPrint)(root->value);
8 PrePrintOrTree(root->rchild,WorkPrint);
9 }
10 void WorkPrint(double value){
11 printf("%.3f ",value);
12 }