Thread: Memory Allocation

  1. #1
    Registered User DutchStud's Avatar
    Join Date
    Oct 2001

    Memory Allocation

    say i have an array of structures that is filled, and then i want to add another one. Do you understand what I'm saying? I have two array elements, and I want to add a third. Is it possible to do this? How?

  2. #2
    time to get into linked lists.

  3. #3
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    ..or you could create a dynamic array, or use a STL vector.

  4. #4
    Registered User Engineer's Avatar
    Join Date
    Oct 2001
    If you don't want to use linked list a cheap and dirty solution would be to create an array of same type of structures which is bigger by one than the original, add the new structure to the new array and delete the original array.
    1 rule of the Samurai Code: if you have nothing to say, don't say anything at all!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory allocation question
    By dakarn in forum C Programming
    Replies: 11
    Last Post: 12-01-2008, 11:41 PM
  2. Dynamic memory allocation.
    By HAssan in forum C Programming
    Replies: 3
    Last Post: 09-07-2006, 05:04 PM
  3. Dynamic memory allocation...
    By dicorr in forum C Programming
    Replies: 1
    Last Post: 06-24-2006, 03:59 AM
  4. C memory allocation to c++
    By markucd in forum C++ Programming
    Replies: 2
    Last Post: 11-30-2005, 05:56 AM
  5. Understanding Memory Allocation
    By Ragsdale85 in forum C Programming
    Replies: 7
    Last Post: 10-31-2005, 08:36 AM