Thread: dynamically allocated strings??

  1. #16
    Resu Deretsiger Nightowl's Avatar
    Join Date
    Nov 2008
    Location
    /dev/null
    Posts
    186
    Post the line you are getting that error message on, then we might be able to help you.

    Or at least, vart will be able to, since I'm going to sleep now.

    Good luck.
    Do as I say, not as I do . . .

    Experimentation is the essence of programming. Just remember to make a backup first.

    "I'm a firm believer that <SomeGod> gave us two ears and one mouth for a reason - we are supposed to listen, twice as much as we talk." - LEAF

    Questions posted by these guidelines are more likely to be answered.

    Debian GNU/Linux user, with the awesome window manager, the git version control system, and the cmake buildsystem generator.

  2. #17
    Registered User
    Join Date
    Feb 2009
    Posts
    19
    Quote Originally Posted by vart View Post
    in this case - use temporary static buffer to enter string and after that use strlen to detrmine the needed space to be allocated like in my example
    Were aren't allowed to use buffers in the assignment for some reason

  3. #18
    Registered User
    Join Date
    Feb 2009
    Posts
    19
    Here's the line:

    Code:
    aStruct->name = string;

  4. #19
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by CS_Student8337 View Post
    Here's the line:

    Code:
    aStruct->name = string;
    you need to add another line - where the aStruct is defined
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dynamically allocated size
    By maverickbu in forum C++ Programming
    Replies: 12
    Last Post: 06-26-2007, 01:16 PM
  2. Build an array of strings dynamically
    By Nazgulled in forum C Programming
    Replies: 29
    Last Post: 04-07-2007, 09:35 PM
  3. scope of dynamically allocated variables
    By lanzyzhang in forum C Programming
    Replies: 4
    Last Post: 07-20-2004, 10:59 AM
  4. I need a dynamically allocated linked list
    By Flex in forum C Programming
    Replies: 2
    Last Post: 03-06-2002, 02:28 PM