Behold the procedure a():
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
typedef unsigned long UL;
void a(unsigned long *d,
unsigned int *j,
unsigned int *k)
{
int i;
printf("d = 0x%016lx\n", (UL) d);
printf("j = 0x%016lx\n", (UL) j);
printf("k = 0x%016lx\n\n", (UL) k);
printf("*j = 0x%08x\n", *j);
printf("*k = 0x%08x\n\n", *k);
for (i = 0; i < 4; i++) {
printf("d[%d] = 0x%16lx\n", i, d[i]);
}
}
When I run this, I get the following output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
d = 0x00007f9cec401798
j = 0x00007f9cec4017e8
k = 0x00007f9cec401790
*j = 0xe3c017ff
*k = 0x00c01705
d[0] = 0x00007f9cec4017c8
d[1] = 0x00007f9cec4017e8
d[2] = 0x00007f9cec4017e0
d[3] = 0x00007f9cec401798
d[4] = 0x00007f9cec4017d8
d[5] = 0x00007f9cec4017b0
d[6] = 0x00007f9cec4017c8
d[7] = 0x00007f9cec4017e8
d[8] = 0x00007f9cec401798
d[9] = 0x00007f9cec4017d8
My machine has 8 byte pointers and is in little endian. Please answer the following questions:
Question 1: What is the byte, in hex, at address 0x00007f9cec4017e8
?
Question 2: What is the byte, in hex, at address 0x00007f9cec4017e9
?
Question 3: What is the byte, in hex, at address 0x00007f9cec4017a8
?
Question 4: What will the following printf()
statement print?
1
printf("0x%08lx\n", k[4]);
Question 5: What wil the following printf()
statement print?
1
2
3
4
unsigned int **x;
x = (unsigned int **) d[5];
printf("0x%08x\n", **x);
PDF Download, 2022 Class Stats, 2023 Class Stats, 2024 Class Stats