Thread: Working with dynamic memory in C++

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Quote Originally Posted by IndioDoido View Post
    I'm working on a project which I can't use vectors, lists, etc... but only dynamic memory :-(
    Sounds like a class assignment, right?

    But i don't know how to do this without using vectors or lists...
    A basic vector is pretty easy to implement. Look for tutorials. You should be able to find one.

    Once you have that, just solve it how you would have done with std::vector. After all, they can't fault you for properly encapsulating your dynamic memory management, can they?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  2. #2
    Registered User IndioDoido's Avatar
    Join Date
    Apr 2007
    Posts
    194
    hey CornedBee, thanks for the fast reply ;-)

    yap! it's a class assignment :-S

    i don't really know if they mean i can't use the std::vector, or both (basic vector and std::vector). I have to ask them.

    Anyway, can std::set be used as an alternative to std::vector? Or am i saying something really stupid? :-S
    "Artificial Intelligence usually beats natural stupidity."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. dynamic memory allocation problem
    By firyace in forum C Programming
    Replies: 4
    Last Post: 05-23-2007, 09:57 PM
  2. Dynamic memory allocation.
    By HAssan in forum C Programming
    Replies: 3
    Last Post: 09-07-2006, 05:04 PM
  3. Dynamic memory alloction for my array of struct
    By pears0 in forum C Programming
    Replies: 13
    Last Post: 03-11-2005, 11:53 AM
  4. dynamic memory allocating error
    By valhall in forum C Programming
    Replies: 2
    Last Post: 04-04-2003, 10:49 AM
  5. static memory and dynamic memory
    By nextus in forum C++ Programming
    Replies: 1
    Last Post: 03-01-2003, 08:46 PM