Given an array of pointers to string literals:
char *textMessages[] = {
"Small text message",
"Slightly larger text message",
"A really large text message that "
"is spread over multiple lines"
}
How does one determine the length of a particular string literal - say the third one? I have tried using the sizeof command as follows:
int size = sizeof(textMessages[2]);
But the result seems to be the number of pointers in the array, rather than the length of the string literal.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…