Thread: proper syntax for const array of strings?

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    403

    proper syntax for const array of strings?

    for some reason i'm getting an error:

    const string[TPL_TEACHER+1] levelstrs = {"New Recruit", "In Training", "Novice", "Master", "Supermaster", "Admin"};

    i bet that this is awful.. i'm doing too much pascal in the CS class at my school and i know that this is similar to the pascal way, could someone refresh my memory.

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    const string levelstrs[TPL_TEACHER+1] = {"New Recruit", "In Training", "Novice", "Master", "Supermaster", "Admin"};
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    403

    haha i feel dumb

    as i thought, very dumb mistake (funny thing is that my non-const array of strings was declared just fine one line down but i never thought to look there)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. array of strings?
    By mc72 in forum C Programming
    Replies: 5
    Last Post: 11-16-2008, 12:15 AM
  2. Replies: 2
    Last Post: 07-11-2008, 07:39 AM
  3. Includes making me insane >.<
    By IceDane in forum C Programming
    Replies: 14
    Last Post: 04-14-2008, 10:24 AM
  4. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 03:49 PM
  5. Merge sort please
    By vasanth in forum C Programming
    Replies: 2
    Last Post: 11-09-2003, 12:09 PM