Memory Allocation

This is a discussion on Memory Allocation within the C++ Programming forums, part of the General Programming Boards category; say i have an array of structures that is filled, and then i want to add another one. Do you ...

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

    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
    Unregistered
    Guest
    time to get into linked lists.

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

  4. #4
    Registered User Engineer's Avatar
    Join Date
    Oct 2001
    Posts
    125
    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, 10: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, 04:56 AM
  5. Understanding Memory Allocation
    By Ragsdale85 in forum C Programming
    Replies: 7
    Last Post: 10-31-2005, 07:36 AM

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