An array of variables can be defined using the syntax '<data type> <variable name> [ <expression> ]'. Any of the types in the Data Types list can be used. For example:
Note that unlike ANSI C, the size of the array can be any expression including variables, functions, or operators. For example
int myArray[ FileSize() - myInt * 0x10 + (17 << 5) ];
The individual elements of the array can be accessed using the '[ ]' operator. For example:
for( i = 0; i < 15; i++ )
myArray[i] = i;
If an array is declared with size zero a warning will be printed out and no variable will be created, but no error will be generated.
An array of characters is treated as a special string type. The keyword 'string' can also be used to declare a string. The operators '=', '+', '+=', and comparison operators can be used on strings as if they were a separate data type. For example:
char str = "First";
string s = "Second";
string r1 = str + s;
string r2 = str;
r2 += s;
return (r1 == r2);
Strings will automatically resize if assigned too many characters, and a warning will be displayed in the Output text area. All strings are assumed to be null-terminated. For a list of functions that can be used when working with strings, see String Functions.
Wide Strings (Unicode Strings)
Regular strings above assume each character can be stored in 8-bits; however
this character size is not appropriate for many languages so 010 Editor
also supports wide strings (also called Unicode strings) where each
character is a 16-bit unsigned short. Use the special 'wstring' type
to define a wide string and each character of a wstring is assumed to be
of type 'wchar_t' (a wchar_t is equivalent to an unsigned short).
The same operators '=', '+' and '+=' are supported for wstrings as for strings and a wide
string constant can be declared by placing a 'L' character before a string or
character constant. For example:
wchar_t str1 = L"How now";
wstring str2 = "brown cow";
wstring str3 = str1 + L' ' + str2 + L'?';
Extended characters can be placed in string constants using the UTF-8 character encoding. Wide strings are assumed to be null-terminated and a list of functions available for
working with wide strings is available in the String Functions help topic.
Wide strings can be converted to regular strings using the WStringToString or
StringToWString functions, or by casting.