Is this valid?

This is a discussion on Is this valid? within the C++ Programming forums, part of the General Programming Boards category; const char *Arrayofstrings[3] { "Some string", "Someotherstring with a different length", "The thrird and last string, as seen above" } ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    125

    Is this valid?

    const char *Arrayofstrings[3]
    {
    "Some string",
    "Someotherstring with a different length",
    "The thrird and last string, as seen above"
    }

    Would this be a valid declaration? I'd try it myself, but I'm writing the code over a LAN and I haven't installed my compiler on this PC...

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    Yes if you insert an assignment operator after the subscript.

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    125
    Oops, totally forgot. Anyway, thanks!
    Typing stuff in Code::Blocks 8.02, compiling stuff with MinGW 3.4.5.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. is this a valid declaration?
    By sanddune008 in forum C Programming
    Replies: 2
    Last Post: 05-13-2009, 04:06 AM
  2. Minimum valid address value
    By BMintern in forum C Programming
    Replies: 6
    Last Post: 04-12-2008, 08:21 AM
  3. recursion error
    By cchallenged in forum C Programming
    Replies: 2
    Last Post: 12-18-2006, 08:15 AM
  4. Are these valid operators
    By Morgan in forum C Programming
    Replies: 3
    Last Post: 08-12-2003, 11:56 AM
  5. Azbia - a simple RPG game code
    By Unregistered in forum Game Programming
    Replies: 11
    Last Post: 05-03-2002, 06:59 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21