Author:
Date: Apr 29, 2008 05:41
How do I find the length of strings within an array at compile time?
The following is not safe:
const char* MyStrings[] =
{
"one",
"two",
"three",
"end marker"
}
#define StringLength(index) MyStrings[index+1] - MyStrings[index]
Since the strings may not be placed consecutively, or in order, within
memory.
Also
#define String1 "one"
#define String2 "two"
#define String3 "three"
|