# 期末考复习

AI悦创原创Python 一对一教学墨尔本大学C语言辅导墨尔本大学C语言一对一辅导墨尔本大学C语言期中考大约 2 分钟...约 465 字

## # Question 12

In the context of the declarations that have been provided, write a function

``````int sum_tree(tree_t *t);
``````

that applies another function

`````` int get_int(data_t *d)
``````

to each data item stored in the tree, and calculates and returns the sum of the integer values generated by the calls to `get_int()`, added up over all of the `data_t` elements stored in the tree. If `t` is empty then `sum_tree(t)` should return zero. You do not need to write `get_int()`, and may call it without knowing anything about its operation.

Include a comment prior to each main block of code to indicate your intentions.

Be sure to select "Preformatted" for the LMS text box before you enter each answer, and (if necessary) again after you have typed your answer. You will need to use spaces for indentation, as tabs cannot be typed into the LMS text box.

malloc tree struct typedef

AI悦创·编程一对一

AI悦创·推出辅导班啦，包括「Python 语言辅导班、C++ 辅导班、java 辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发、Web、Linux」，全部都是一对一教学：一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。当然，还有线下线上摄影课程、Photoshop、Premiere 一对一教学、QQ、微信在线，随时响应！微信：Jiabcdefh

C++ 信息奥赛题解，长期更新！长期招收一对一中小学信息奥赛集训，莆田、厦门地区有机会线下上门，其他地区线上。微信：Jiabcdefh

• 0
• 0
• 0
• 0
• 0
• 0

• 按正序
• 按倒序
• 按热度