public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* string initialization
@ 2004-03-24 13:21 Massimiliano Cialdi
  2004-03-24 13:35 ` Eljay Love-Jensen
  0 siblings, 1 reply; 2+ messages in thread
From: Massimiliano Cialdi @ 2004-03-24 13:21 UTC (permalink / raw)
  To: gcc help

I want to initialize staticly a string like this:
"abc\0defg\0hi\0"

if I define:
char *str[] = {
"abc",
"defg",
"hi" };

can I be sure that the 3 strings are placed consecutively? 
In this way I declase an array of strings. There is another way to avoid
this?

thanks

-- 
Massimiliano Cialdi
cialdi@firenze.net
m.cialdi@oksys.it

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: string initialization
  2004-03-24 13:21 string initialization Massimiliano Cialdi
@ 2004-03-24 13:35 ` Eljay Love-Jensen
  0 siblings, 0 replies; 2+ messages in thread
From: Eljay Love-Jensen @ 2004-03-24 13:35 UTC (permalink / raw)
  To: Massimiliano Cialdi, gcc help

Hi Massimiliano,

You can do this:

char* str = "abc\0defg\0hi";

HTH,
--Eljay

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-03-24 11:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-24 13:21 string initialization Massimiliano Cialdi
2004-03-24 13:35 ` Eljay Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).