#include
struct TreeNode {
int val;
struct TreeNode* left;
struct TreeNode* right;
};
struct TreeNode* fun() {
struct TreeNode* root = malloc(sizeof(struct TreeNode));
root->val = 1;
return root;
}
int main() {
fun();
return 0;
}
malloc返回void*,要转换一下
struct TreeNode* fun() {
struct TreeNode* root =(struct TreeNode*) malloc(sizeof(struct TreeNode));
root->val = 1;
return root;
}