#: 17143 S12/OS9/68000 (OSK)
21-Nov-92 20:08:50
Sb: #C Casts
Fm: Bob van der Poel 76510,2203
To: All
Here's another C question:
I have an array of pointer to char declared in my program. Let's say it look
like:
char *items[]={"one","two","three"};
Is it possible to determine the lengths of the strings at compile time? I'd
like to be able to do something like:
int len1=sizeof(items[0]);
But that sets len1 to the size of the pointer (4), not the length of the string
(3). Do I have to go through with strlen() for the whole list or is there a
compile time method?
There are 2 Replies.
|