Here is the state of addresses 0x7fa586401790
through 0x7fa58640182f
. Our machine is little endian with 8-byte pointers.
Here is a procedure, pm():
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
void pm(unsigned long *p) {
unsigned long **q;
unsigned long ***r;
unsigned long ****s;
q = (unsigned long **) p;
r = (unsigned long ***) p;
s = (unsigned long ****) p;
printf("0x%021x\n", (*p) & 0xff); /* Line 1 of output. */
printf("0x%021x\n", (**q) & 0xff); /* Line 2 of output. */
printf("0x%021x\n", (***r) & 0xff); /* Line 3 of output. */
printf("0x%021x\n", (****s) & 0xff); /* Line 4 of output. */
printf("0x%021x\n", (p[1]) & 0xff); /* Line 5 of output. */
printf("0x%021x\n", (q[1][1]) & 0xff); /* Line 6 of output. */
}
Suppose pm() is called with p equal to 0x7fa586401790
:
Question 1: What is the first line of ouput?
Question 2: What is the second line of ouput?
Question 3: What is the third line of ouput?
Question 4: What is the fourth line of ouput?
Question 5: What is the fifth line of ouput?
Question 6: What is the sixth line of ouput?
PDF Download, 2022 Class Stats, 2023 Class Stats, 2024 Class Stats