prog.cpp:3:25: error: ‘TreeNode’ has not been declared
int countPathHelper(TreeNode* node, int sum, int currentSum){
^~~~~~~~
prog.cpp:10:17: error: ‘TreeNode’ has not been declared
int pathSum(TreeNode* root, int sum) {
^~~~~~~~
prog.cpp: In member function ‘int Solution::countPathHelper(int*, int, int)’:
prog.cpp:4:20: error: ‘NULL’ was not declared in this scope
if(node == NULL) return 0;
^~~~
prog.cpp:4:20: note: ‘NULL’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’?
prog.cpp:1:1:
+#include <cstddef>
class Solution {
prog.cpp:4:20:
if(node == NULL) return 0;
^~~~
prog.cpp:5:29: error: request for member ‘val’ in ‘* node’, which is of non-class type ‘int’
currentSum += node->val;
^~~
prog.cpp:7:42: error: request for member ‘left’ in ‘* node’, which is of non-class type ‘int’
return countPathHelper(node->left,sum,currentSum) + countPathHelper(node->right,sum,currentSum) + (currentSum == sum);
^~~~
prog.cpp:7:87: error: request for member ‘right’ in ‘* node’, which is of non-class type ‘int’
return countPathHelper(node->left,sum,currentSum) + countPathHelper(node->right,sum,currentSum) + (currentSum == sum);
^~~~~
prog.cpp: In member function ‘int Solution::pathSum(int*, int)’:
prog.cpp:11:20: error: ‘NULL’ was not declared in this scope
if(root == NULL) return 0;
^~~~
prog.cpp:11:20: note: ‘NULL’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’?
prog.cpp:12:60: error: request for member ‘right’ in ‘* root’, which is of non-class type ‘int’
return countPathHelper(root,sum,0) + pathSum(root->right,sum) + pathSum(root->left,sum);
^~~~~
prog.cpp:12:87: error: request for member ‘left’ in ‘* root’, which is of non-class type ‘int’
return countPathHelper(root,sum,0) + pathSum(root->right,sum) + pathSum(root->left,sum);
^~~~