NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: AntonPotapov on April 24, 2023, 01:34:07 PM

Title: Preprocessor. Array
Post by: AntonPotapov on April 24, 2023, 01:34:07 PM
How to use a string as an array in the preprocessor?
For example I have a string:
Code: [Select]
%define string "Hello World"
how do i get e.g. 'W' ?
Does the preprocessor have arrays?
I want to get a string character similar to C:
Code: [Select]
char *str = "Hello World";
char ch = str[6]; // just like that

I recently started learning assembler, literally half a week ago. I read the documentation: https://www.nasm.us/xdoc/2.16.01/html/nasmdoc4.html.
I found operators like substr, which should be enough for my purposes. But I want to understand the preprocessor more thoroughly.