/* The structure of the Linked list Node is as follows:
struct Node
{
int val;
struct Node *next;
Node(int data){
val = data;
next = NULL;
}
};
*/
void intersection(Node **head1, Node **head2,Node **head3)
{
cout<<*head1->val;
}
The above code in not working but when I take another pointer Node* h1=*head1;
and then print its value its working fine. In both codes the value I want to print is same then why above code is wrong;
/* The structure of the Linked list Node is as follows:
struct Node
{
int val;
struct Node *next;
Node(int data){
val = data;
next = NULL;
}
};
*/
void intersection(Node **head1, Node **head2,Node **head3)
{
Node* h1=*head1;
cout<<h1->val;
}
Aucun commentaire:
Enregistrer un commentaire