Strings
Basically, string is just an array, which elements
are characters or wide (UNICODE) characters. The main difference is in the way
the string is edited - string is treated as a single object, not as a set of
independent values.
Like any array, a string may be either of a fixed
or of a variable length.
struct PascalString {
unsigned byte StrLength;
char String[StrLength];
};
Zero Terminated Strings
In addition to fixed and variable size specifier, character arrays may have
no size specifier at all.
struct CString {
char szString[];
};
This syntax is allowed only to character and wide character arrays and means
that the string is zero-terminated. The actual size of the string is calculated
as the number of characters including the terminating zero character.
 |
You cannot declare a zero-terminated string type. Strings with omitted size
specifier may occur only as a field declaration within a composite data object
(structure or union).
|
|