Draw the linked list and determine the sentence being stored in the linked list.
ID: 3589787 • Letter: D
Question
Draw the linked list and determine the sentence being stored in the linked list.
Given the following structure #define SIZE 8 struct lnode f char strlsize]; sruct lnode *next; And we know that the variable list is the start of the list, so we execute the following command in gdb to find the start of the list gdb) print list $1 = (struct Inode *)0x6020b0 (gdb) x/60x 0x602000 0x602000 0x602010: 0x602020: 0x602030 0x602040: 0x602050 0x602060 0x602070 0x602080 0x602090 0x6020a0 0x6020b: 0x6020c0 0x6020do: 0x6020e 0x00000000 Ox3f74306e 0x00000000 x00ea726f 0x00000000 0x0a656874 0x00000000 ex6c306f63 0x00000000 0x36325343 0x00000000 Ox000a7349 0x00000000 0x00000000 0x00000000 0x00000000 0x0000000a 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00747365 0x00000000 0x00000a49 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000021 0x00000000 0x00000021 0x00602010 0x00000021 0x00602070 0x00000021 0x00602030 0x00000021 0x00602050 0x00000021 0x00602090 ex00020f41 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000Explanation / Answer
Start address 0x6020b0, str is 0x49 73 0a 00 00 00 00 00 and next = address is 0x602090, considering big endian where MSB is stored at least significant bit
Using ASCII table, we can get str = Is'LF' where LF is linefeed.
At address 0x602090, str is 0x43 53 32 36 49 0a 00 00 and next = address is 0x602050,
str = CS26I'LF'
At address 0x602050, str is 0x 74 68 65 0a 00 00 00 00and next address is 0x00602070
str = the'LF'
At address 0x602070, str is 0x 63 6f 30 6c 65 73 74 00 and next address is 0x00602030
str = co0lest
At address 0x602030, str is 0x 6f 72 0a 00 00 00 00 00 and next address is 0x00602010
str = or'LF'
At address 0x602010, str is 0x 6e 30 74 3f 0a 00 00 00 00 and next address is 0x00000000
str = n0t?'LF'
So, combining all messages we get
Is'LF' CS26I'LF 'the'LF' co0lest or'LF' n0t?'LF'
where LF is line feed.
so we have 6 nodes.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.