Computer Sciences > Gate 2017 Set-1 > Pointer
Consider the C code fragment given below.

typedef struct node
{
    int data;
    node* next ;
} node;
void join(node* m, node* n)
{
    node* p = n;
    while (p->next != NULL)
    {
        p = p->next;
    }
    pโ€“>next = m;
}

Assuming that m and n point to valid NULL- terminated linked lists, invocation of join will
A
append list m to the end of list n for all inputs
B
either cause a null pointer dereference or append list m to the end of list n
C
cause a null pointer dereference for all inputs.
D
append list n to the end of list m for all inputs.

Correct : Pointer

Similar Questions

Consider the following C code: #include<stdio.h> int * assignval (int *x, int val) {     *x = val;     return x; } int main()...
#204 MCQ
Consider the following C code: #include<stdio.h> int * assignval (int *x, int val) {     *x = val;     return x; } int main()...
#204 MCQ
Consider the following C code: #include<stdio.h> int * assignval (int *x, int val) {     *x = val;     return x; } int main()...
#204 MCQ

Related Topics

No tags found

Unique Visitor Count

Total Unique Visitors

Loading......