0123456789ABCDEFGHIJ0123456789* ^ ^ ^ x y zThe strcpy(z, "") command turns it into the following:
0123456789ABCDEFGHIJ*23456789* ^ ^ ^ x y zAnd the strcat(y, "#") command turns it into the following:
0123456789ABCDEFGHIJ#*3456789* ^ ^ ^ x y zFinally, the two lines that set "*y" and "z[5]":
0123456789*BCDEFGHIJ#*34*6789* ^ ^ ^ x y zBelow, I show the five values of x in the for loop:
0123456789*BCDEFGHIJ#*34*6789* ^ ^ ^ ^ ^The answer is:
UNIX> a.out 0123456789 789 EFGHIJ# # 89 UNIX>
i[0] 

i[1] 

So, c[0] through c[3] are the four bytes of i[0], and c[4] through c[7] are the four bytes of i[1]. Thus, the first two lines are:
1: 0x67 0xef 0xcd 0xab 2: 0xeb 0x24 0xda 0x13Now, when we perform the memcpy this copies c[2] through c[5] into v:
v 

When we print v in hex, it prints the above four bytes in little endian:
3: 0x24ebabcdThe next statements copy c[0] and c[1] into the first two bytes of v (remember, vp points to the first byte of v), and c[6] and c[7] into the last two bytes of v. This turns v into:
v 

When we print v in hex, it prints the above four bytes in little endian:
4: 0x13daef67Now, when we add 0x10101 to i[0] that increments each of the first three bytes by one. i[0] is now:
i[0] 

So, when we print out the bytes, we get:
5: 0x68 0xf0 0xce 0xabFinally, when we add one to c[4] and two to c[5], the state of i becomes:
i[0] 

i[1] 

When we print the two values in i, they are printed in little endian:
6: 0xabcef068 7: 0x13da26ecPutting it all together, the answer is:
UNIX> gcc m32 q3.c UNIX> a.out 1: 0x67 0xef 0xcd 0xab 2: 0xeb 0x24 0xda 0x13 3: 0x24ebabcd 4: 0x13daef67 5: 0x68 0xf0 0xce 0xab 6: 0xabcef068 7: 0x13da26ec UNIX>
So, the first three lines are:
0 @ 8 
So, the next three lines are:
2028278088 2028278092 2028278088 
When you are calculating e[2], you need to add eight to e, because e points to a fourbyte quantity (a pointer). Then, you add eight to e[2] to find e[2][1]. So, the last four lines are
2.27934735e+274 2.27939357e+274 2.27938697e+274 2.27939357e+274 
UNIX> gcc m32 q4.c UNIX> a.out 0x78e51120 2.27938697e+274 2028278064 0x78e51130 '0'     'x' 0x78e51124 2028278084 0x78e51144 'D'     'x' 0x78e51128 2.27936055e+274 2028278088 0x78e51148 'H'     'x' 0x78e5112c 2028278068 0x78e51134 '4'     'x' 0x78e51130 2.27934735e+274 2028278080 0x78e51140 '@'     'x' 0x78e51134 2028278060 0x78e5112c ','     'x' 0x78e51138 2.27938697e+274 2028278064 0x78e51130 '0'     'x' 0x78e5113c 2028278084 0x78e51144 'D'     'x' 0x78e51140 2.27940017e+274 2028278072 0x78e51138 '8'     'x' 0x78e51144 2028278092 0x78e5114c 'L'     'x' 0x78e51148 2.27939357e+274 2028278072 0x78e51138 '8'     'x' 0x78e5114c 2028278088 0x78e51148 'H'     'x' 1: 0 2: @ 3: 8 4: 2028278088 5: 2028278092 6: 2028278088 7: 2.27934735e+274 8: 2.27939357e+274 9: 2.27938697e+274 A: 2.27939357e+274 UNIX>
UNIX> gcc m32 q5.c UNIX> a.out 0x61626324 1633837882 0x6162633a ':' 'c' 'b' 'a' 0x61626328 1633837928 0x61626368 'h' 'c' 'b' 'a' 0x6162632c 1633837875 0x61626333 '3' 'c' 'b' 'a' 0x61626330 1633837868 0x6162632c ',' 'c' 'b' 'a' 0x61626334 1633837870 0x6162632e '.' 'c' 'b' 'a' 0x61626338 1633837934 0x6162636e 'n' 'c' 'b' 'a' 0x6162633c 1633837934 0x6162636e 'n' 'c' 'b' 'a' 0x61626340 1633837904 0x61626350 'P' 'c' 'b' 'a' 0x61626344 1633837887 0x6162633f '?' 'c' 'b' 'a' 0x61626348 1633837928 0x61626368 'h' 'c' 'b' 'a' 0x6162634c 1633837863 0x61626327 ''' 'c' 'b' 'a' 0x61626350 1633837872 0x61626330 '0' 'c' 'b' 'a' 0x61626354 1633837909 0x61626355 'U' 'c' 'b' 'a' 0x61626358 1633837933 0x6162636d 'm' 'c' 'b' 'a' 0x6162635c 1633837860 0x61626324 '$' 'c' 'b' 'a' 0x61626360 1633837880 0x61626338 '8' 'c' 'b' 'a' 0x61626364 1633837879 0x61626337 '7' 'c' 'b' 'a' 0x61626368 1633837890 0x61626342 'B' 'c' 'b' 'a' 0x6162636c 1633837903 0x6162634f 'O' 'c' 'b' 'a' 0x61626370 1633837900 0x6162634c 'L' 'c' 'b' 'a' 0x61626374 1633837906 0x61626352 'R' 'c' 'b' 'a' 0x61626378 1633837944 0x61626378 'x' 'c' 'b' 'a' 0x6162637c 1633837927 0x61626367 'g' 'c' 'b' 'a' 1: 0x61626324 2: : c b a 3: 1633837928 4: a . c b 5: 0x61626334 6: . c b a 7: 1633837934 8: b a L c 9: 0x61626364 A: 7 c b a B: 1633837890 C: a 0 c b D: 0x6162632c E: 3 c b a F: 1633837868 G: b a , c H: 0x61626368 I: B c b a J: 1633837903 K: ' c b a UNIX>