Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In the following code, A and B are constants defined with #define: Does A = 5 an

ID: 3686713 • Letter: I

Question

In the following code, A and B are constants defined with #define:

Does A = 5 and B = 6? How do you find these values?

How do you find the gaps & what are they?

typedef struct t char w[A] [B]; int x; J strl; typedef struct t short y[B]; int p; double z [B] short q J str2; doSub(str1l *t, str2 *u) int v1 = u-p ; int v2 = u-q t-x = v1-v2; void The following assembly code is generated for the doSub procedure: doSub: movswl 96(%rsi), %edx movi 20(%rsi), %eax subl %eax, %eax movi %eax , 49(%rdi) ret

Explanation / Answer

Answer:

a char starts at any BYTE

a short starts only at EVEN bytes

an int starts at BYTE, but divisible by 4

a long starts at BYTE which is divisible by 8

str1.w is long which starts at 5 to 8

str1.x may have 184 or 180

str2.p is int starts at the value 8, hence str1.array which holds from 5 to 8 BYTES

str2.q short may be 14 to 20

str2.z may be 32

char w[A][B] and int X

8                              184

Str2.

short[B]      int p        doublez[B]          short q  

20                  4                 8                          9

hence the value of A=5 and B=6    

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote