I was reading about trees and a possible implementation of the 3 traversal functions (from : Data Structures Using C and C++). The Node struct is :
struct node
{
int info;
node* left;
node* right;
}node;
typedef struct node * nodeptr ;
The implementation of Preorder traverse took a simple pointer of type node:
void preorder(node *root);
But when it came to Inorder function, it was declared as following :
void inorder(nodeptr *root)
If I'm not mistaken, and since I looked it up online, in this case nodeptr* would mean ** node right ? If that's the case, why are we declaring a double pointer of type node for a traverse function ?
Another thing,
inorder(root→left);
if root is a double pointer of type node, can we actually write root->left to access the attributes of the node it points to ? (as if it were a simple pointer) ?
Edit: I'm just copying what was written in the book and what was given in class. I just had a hard time understanding why, that's all.