Hello. I am having an issue running my program due to a "0xC0000005: Access violation writing location" error. The purpose of the program is to create a binary tree using pointers, and to traverse through the trees with preorder, inorder, and post order algorithms.(The tree does not have to follow the left node being less than the root and the right being greater than the root rule.) Thank You in advance.
node is an array of pointers, none of which point at an actual TreeNode object.
node[i]->info = nums[i];
This is an attempt to dereference one of those pointers, which is pointing somewhere in memory. Could be anywhere. This is bad.
When you make a pointer, you need to also make something for it to point at, and then make it actually point at that object. THEN you can dereference the pointer.