SE250:lab-2:zyan057
Jump to navigation
Jump to search
Task 1
On both the lab machine and the Linux server the pointers for all the types are 4 bytes.
Task 2
lab machine:
&x = 0x22cca4, &y = 0x22cca0, diff = 1 <- (long)(&x-&y) &x = 0x22cca4, &y = 0x22cca0, diff = 4 <- (long)&x-(long)&y
Linux server:
&x = 0xffc6e74c, &y = 0xffc6e748, diff = 1 <- (long)(&x-&y) &x = 0xffc6e74c, &y = 0xffc6e748, diff = 4 <- (long)&x-(long)&y
The differences are the same, the only differences are the adresses.
Task 3
Lab machine:
&arr=0x22cca0, arr+4=0x22cca4, &arr[4]=0x22cca4 &x = 0x22cca4, &y = 0x22cc9c, diff = 2 &x = 0x22cca4, &y = 0x22cc9c, diff = 8
array size diff between &x and &y in bytes 0 32 1 8 2 8 3 32 4 8 5 32 6 32 7 32 8 16 9 32 10 32
x=10,y=0
Linux server:
&arr=0xffc6e748, arr+4=0xffc6e74c, &arr[4]=0xffc6e74c &x = 0xffc6e74c, &y = 0xffc6e744, diff = 2 &x = 0xffc6e74c, &y = 0xffc6e744, diff = 8 array size diff between &x and &y in bytes 0 4 1 4 2 4 3 4 4 8 5 4 6 4 7 4 8 4 9 4 10 4
x=167772160,y=0