Arrays/strings

This is a discussion on Arrays/strings within the C Programming forums, part of the General Programming Boards category; I want to get a string from input but I don't want to waste any space by declaring a char ...

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    55

    Arrays/strings

    I want to get a string from input but I don't want to waste any space by declaring a char array with elements that may not be used. A pointer to char wouldn't be much different I assume. So what are my options here?

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Your options are:
    1. Declare a char array with enough space.
    2. Write an entirely new string library from scratch that automatically resizes itself.

  3. #3
    Registered User
    Join Date
    Aug 2008
    Posts
    55
    Heh, that's what I was afraid of.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginners question about arrays/strings
    By Wiretron in forum C Programming
    Replies: 2
    Last Post: 11-07-2005, 03:34 PM

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