Skip to Content
The Art of Assembly Language, 2nd Edition
book

The Art of Assembly Language, 2nd Edition

by Randall Hyde
March 2010
Beginner content levelBeginner
760 pages
18h 51m
English
No Starch Press
Content preview from The Art of Assembly Language, 2nd Edition

4.18 Declaring Arrays in Your HLA Programs

Before you can access elements of an array, you need to set aside storage for that array. Fortunately, array declarations build on the declarations you've already seen. To allocate n elements in an array, you would use a declaration like the following in one of the variable declaration sections:

ArrayName: basetype[n];

ArrayName is the name of the array variable and basetype is the type of an element of that array. This sets aside storage for the array. To obtain the base address of the array, just use ArrayName.

The [n] suffix tells HLA to duplicate the object n times. Now let's look at some specific examples.

static CharArray: char[128]; // Character array with elements 0..127. ByteArray: byte[10]; // Array ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

x64 Assembly Language Step-by-Step, 4th Edition

x64 Assembly Language Step-by-Step, 4th Edition

Jeff Duntemann
C Programming Language, 2nd Edition

C Programming Language, 2nd Edition

Brian W. Kernighan, Dennis Ritchie

Publisher Resources

ISBN: 9781593272074Errata Page