In C++, I was trying to access the struct members through double pointer headref as shown below
struct Node{
int data;
struct Node* next;
};
struct Node* head = new Node;
head->data = 10;
head->next = NULL;
struct Node** headref = &head;
However, accessing as *headref->data produces errors while casting it ((Node*)*headref)->data works. Why?