c语言函数指针
时间:2014-05-28 01:40:35
收藏:0
阅读:198
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 }
评论(0)