TIP: Click on subject to list as thread! ANSI
echo: cis.os9.68000.osk
to: All
from: Bob van der Poel 76510,2203
date: 1992-11-21 20:08:50
subject: #C Casts

#: 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.

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.