Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Nullio

const String array

This topic is 6104 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need to defined a const string array can I do this: char *list[5] = { "item1" , "item2" , "item3", "item4", "item5"}

Share this post


Link to post
Share on other sites
Advertisement
You can do this:

char arr[5][] = { "item1", "item2", "item3", "item4", "item5" };

The strings themselves are allowed to be of variable length, but the string array has only 5 elements. Modify as necessary.

Share this post


Link to post
Share on other sites
True. The second is just more "expressive." And rather than asking whether you can, try it!

Thanks for the lookout, Null and Void (can I call you N&V?)

Share this post


Link to post
Share on other sites
quote:
Original post by Oluseyi
True. The second is just more "expressive." And rather than asking whether you can, try it!


Exactly why I didn''t respond in the first place, I figured he''d go try it on his own eventually .

quote:
Original post by Oluseyi
Thanks for the lookout, Null and Void (can I call you N&V?)

I don''t care how people abreviate my name , I''ll sometimes even type it as ''nav'' since it is somewhat awkward to type out.

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!