878 views

1 Answer

Best answer
2 2 votes

Option must be option D.

Explanation :

initially F is pointing to node with value 1.

Step 1 : P = F->link->link->link->link

F->link = 1->link =2

(F->link)->link = 2->link =3

(F->link->link)->link = 3->link = 4

(F->link->link->link)->link = 4->link =5 (Hence P is poinitng at node with value =5)

Step 2 : P->link->link = F->link->link

We are assigning value of (F->link)->link to P->link->link

F->link = 1->link = 2

(F->link)->link = 2->link =3.

Now, P->link = 6

P->link->link = 6->link = null.

Hence last null value will now points to node with value 3.

Step 3 : F->link = p->link

already we have computed p->link .

Hence F->link = 6.(Simple 1st node now point to 6 directly instead of 2).

Printing :

p->data = 5.

F->link->link->link->link->data = 1->6->3->4->5 (data of node 5) = 5

P->link->link->link->link->data = 5->6->3->4->5 (data of node 5) = 5.

• selected by
Position:
Show:

Related questions

1 1 vote
0 0 answers
669
669 views
sumit_kumar asked Jul 28, 2017
669 views
Somewhere I read that we cann't get addresses of constants or expressions as these are not saved in memory (regarding C), we can get addresses of variables or structures ...
0 0 votes
0 0 answers
452
452 views
Sahil_Lather asked Jan 28, 2023
452 views
Consider the following C function executed in an OS with paging where the page size is 4 kilobytes. Further, assume that the system employs a 32-entry direct mapped TLB.i...