dynamically allocated strings??

This is a discussion on dynamically allocated strings?? within the C Programming forums, part of the General Programming Boards category; Post the line you are getting that error message on, then we might be able to help you. Or at ...

  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
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    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
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

Page 2 of 2 FirstFirst 12
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, 01:28 PM

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