194k views
0 votes
Given the following array definition, write a constant declaration named ArraySize that automatically calculates the size in bytes, of the array:

newArray DWORD 10,20,30,40,50
a) arraysize=(S-newArray)
b) arraysize#(S-new,Array)/2
c) arraySize- (S-newArray)/4
d) arraySize- (S-arraySize)

User RMPR
by
5.0k points

1 Answer

4 votes

Answer:

ArraySize = ($ - newArray)

Step-by-step explanation:

Given

Array name: newArray

Type: DWORD

Required

The size of the array in bytes

The following formula is used to calculate the size of an array in assembly language.

Variable = ($-Array name)

So, we have:

ArraySize = ($ - newArray)

Where ArraySize is the variable that holds the size of newArray (in bytes)

User Kspearrin
by
5.3k points