It was pointed out some time ago in this thread that countNodes() requires a treeNode* as an argument.
http://www.cplusplus.com/forum/beginner/41919/#msg226674
ne555 wrote:
int countNodes(TreeNode *root) Note that it should receive a pointer.
Yes, that's the problem. I did not declare any pointer, the only pointer i declare is treeNode* root = NULL. Other than that are just inserting, appending and deleting a node. I suppose i do not have a nodePointer in this case.