Question
Consider the following definition of a struct: struct lnode { char *str; // points to 14-character string int size; // size of the string struct
Consider the following definition of a struct:
struct lnode { char *str; // points to 14-character string int size; // size of the string struct lnode *next; // points to next node address struct lnode *prev; // points to prev node address };
We know from the source code that the variable "list" is the start of a linked list. We can execute the following command in gdb to find the start of the linked list:
(gdb) print list $1 = (struct lnode *) 0x55555555b2b0
We can also look at the memory where the list resides
(gdb) x/80xg 0x55555555b2b0 0x55555555b2b0: 0x000055555555b2e0 0x000000000000000d 0x55555555b2c0: 0x000055555555b300 0x0000000000000000 0x55555555b2d0: 0x0000000000000000 0x0000000000000021 0x55555555b2e0: 0x656e6f207473754a 0x0000006c616d7320 0x55555555b2f0: 0x0000000000000000 0x0000000000000031 0x55555555b300: 0x000055555555b330 0x000000000000000d 0x55555555b310: 0x000055555555b350 0x000055555555b2b0 0x55555555b320: 0x0000000000000000 0x0000000000000021 0x55555555b330: 0x697469736f70206c 0x0000006874206576 0x55555555b340: 0x0000000000000000 0x0000000000000031 0x55555555b350: 0x000055555555b380 0x000000000000000d 0x55555555b360: 0x000055555555b3a0 0x000055555555b300 0x55555555b370: 0x0000000000000000 0x0000000000000021 0x55555555b380: 0x6e6920746867756f 0x0000002065687420 0x55555555b390: 0x0000000000000000 0x0000000000000031 0x55555555b3a0: 0x000055555555b3d0 0x000000000000000d 0x55555555b3b0: 0x000055555555b3f0 0x000055555555b350 0x55555555b3c0: 0x0000000000000000 0x0000000000000021 0x55555555b3d0: 0x20676e696e726f6d 0x00000063206e6163 0x55555555b3e0: 0x0000000000000000 0x0000000000000031 0x55555555b3f0: 0x000055555555b420 0x000000000000000d 0x55555555b400: 0x000055555555b440 0x000055555555b3a0 0x55555555b410: 0x0000000000000000 0x0000000000000021 0x55555555b420: 0x6f792065676e6168 0x0000006877207275 0x55555555b430: 0x0000000000000000 0x0000000000000031 0x55555555b440: 0x000055555555b470 0x000000000000000d 0x55555555b450: 0x000055555555b490 0x000055555555b3f0 0x55555555b460: 0x0000000000000000 0x0000000000000021 0x55555555b470: 0x2e79616420656c6f 0x000000209480e220 0x55555555b480: 0x0000000000000000 0x0000000000000031 0x55555555b490: 0x000055555555b4c0 0x000000000000000b 0x55555555b4a0: 0x0000000000000000 0x000055555555b440 0x55555555b4b0: 0x0000000000000000 0x0000000000000021 0x55555555b4c0: 0x614c2069616c6144 0x000000000000616d 0x55555555b4d0: 0x0000000000000000 0x000000000001eb31 0x55555555b4e0: 0x0000000000000000 0x0000000000000000 0x55555555b4f0: 0x0000000000000000 0x0000000000000000 0x55555555b500: 0x0000000000000000 0x0000000000000000
Given this information, answer the following questions about the linked list.
1.Give the starting address of the first node of the linked list (as a hexadecimal address).
2.Give the size of a single node of the linked list (in bytes)
3.Give the starting address of the last node in the linked list (as a 64-bit hexadecimal address).
4.How many nodes are there in the linked list?
5.What is the string that is stored in the linked list (across all the nodes)?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started