?
Consider the following code snippet
Consider the following code snippet
function tail(o)
{
for (; o.next; o = o.next) ;
return o;
}
Will the above code snippet work? If not, what will be the error?
function tail(o)
{
for (; o.next; o = o.next) ;
return o;
}
Answer & Solution
Correct Answer:
Option
C
The above code uses a for loop to traverse a linked list data structure and return the last object in the list. This will perfectly work.
Join the Discussion
Login to post a comment or share your explanation.
Login