Say I have the following:
var1 db 01h,02h,03h,04h
Is there a way to tell how many values I have in var1 (4 values)?
Hi Troy
This is quoted from the MASM reference:
QuoteThe LENGTHOF operator returns the number of data items allocated
for <variable>. The SIZEOF operator returns the total number of
bytes allocated for <variable> or the size of <type> in bytes. For
variables, SIZEOF is equal to the value of LENGTHOF times the
number of bytes in each element.
Therefore "lengthof var1" will return a value of 4
Chris
Quote
var1 db 01h,02h,03h,04h
Is there a way to tell how many values I have in var1 (4 values)?
Also note that "var1" and variables in general do not work the same in assembler as in other languages - there is really no such thing as a variable in assembler, only data and offsets. See \masm32\help\asmintro.hlp for a complete explanation.