I am learning about linked lists, and I want to know if it is okay to pass by address operator or by pointer in the parameter for the given function:
void Push(struct Node **head_ref, int data)
{
struct Node *new_node = (struct Node*)malloc(sizeof(struct Node));
new_node->data = data;
new_node->next = (*head_ref);
(*head_ref) = new_node;
}
void Push(struct Node *&head_ref, int data)
{
struct Node *new_node = (struct Node*)malloc(sizeof(struct Node));
new_node->data = data;
new_node->next = head_ref;
head_ref = new_node;
}