char

This is a discussion on char within the C++ Programming forums, part of the General Programming Boards category; To declare a string of 50 letters, you would want to say: char string[50]; Ok thats pretty clear... But how ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    21

    char

    To declare a string of 50 letters, you would want to say:

    char string[50];


    Ok thats pretty clear... But how can you declare a string of infinity letters????

    ~tare

  2. #2
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    You don't have infinte memory, therefore you cannot have an infinitely long char array. I'd recommend using std::string in the <string> library, as it resizes when needed.

    http://www.msoe.edu/eecs/ce/courseinfo/stl/string.htm
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 06:02 AM
  2. Sorting Linked Lists
    By DKING89 in forum C Programming
    Replies: 6
    Last Post: 04-09-2008, 07:36 AM
  3. code condensing
    By bcianfrocca in forum C++ Programming
    Replies: 4
    Last Post: 09-07-2005, 09:22 AM
  4. Passing structures... I can't get it right.
    By j0hnb in forum C Programming
    Replies: 6
    Last Post: 01-26-2003, 10:55 AM
  5. String sorthing, file opening and saving.
    By j0hnb in forum C Programming
    Replies: 9
    Last Post: 01-23-2003, 12:18 AM

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