adplus-dvertising
frame-decoration

Question

What’s wrong with this code which returns xor of two nodes address ?
//struct is common userdefined datatype in c/c++ and class is it's alternative
 
struct node* XOR (struct node *a, struct node *b) 
{
    return  ((int) (a) ^ (int) (b));   //this logic is used to fill the nodes with address of a xor linked list
}

a.

nothing wrong. everything is fine

b.

type casting at return is missing

c.

parameters are wrong

d.

total logic is wrong

Answer: (b).type casting at return is missing

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What’s wrong with this code which returns xor of two nodes address ?