What8217s Wrong With This Code Which Returns Xor Of Two Nodes #461
What’s wrong with this code which returns xor of two nodes address ?</p> <pre><code class="language-java"> //struct is common userdefined datatype in c/c++ and class is it's alternative struct node* XOR (struct node *a, struct node *b) { //this logic is used to fill the nodes with address of a xor linked list return ((int) (a) ^ (int) (b)); } </code></pre>
This multiple choice question (MCQ) is related to the book/course
gs gs121 Data Structures and Algorithms.
It can also be found in
gs gs121 Types of Lists - Xor Linked List - Quiz No.1.
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) { //this logic is used to fill the nodes with address of a xor linked list return ((int) (a) ^ (int) (b)); }
nothing wrong. everything is fine
type casting at return is missing
parameters are wrong
total logic is wrong
Similar question(s) are as followings:
Online Quizzes of gs121 Data Structures and Algorithms
Binary Trees - Binary Search Tree - Quiz No.1
gs gs121 Data Structures and Algorithms
Online Quizzes
Binary Trees - Binary Search Tree - Quiz No.2
gs gs121 Data Structures and Algorithms
Online Quizzes
Binary Trees - Preorder Traversal - Quiz No.1
gs gs121 Data Structures and Algorithms
Online Quizzes