Quick Question about passing a struct as a function arg. Maybe its a carry over from C that makes no difference in C++.
In many Linked List examples you see them re-declare the word struct in any function argument that takes a struct and I don't understand why. Or any allocation for that matter. A structure is its own object and declaring just the name of the struct is sufficient.
Example:
struct Node{
int data;
Node * next;
};
// Function to output data.
void printNode(struct Node* myNode){
// Print data of node
}
why is the word struct re-declared in the function arg. Declaring type Node* works just fine.
Thanks.