Thread: Convert from string to int.

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    I suggest reaching for a std::vector<int>. You can then also return it from the function, or, if appropriate, it might be more suitable as a member variable instead. The alternative does involve new[], but I would not use it unless I really have to.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #17
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Pass an address of a struct (or class) allocated on the heap around then, (as a function arg)

  3. #18
    Registered User
    Join Date
    May 2007
    Thank you for your suggestions :-)

    I eventually solved it by creating an int pointer.

    int * temp;
    then further down just said
    temp = new int[value];
    Thanks for your help - my assignment (a media player) is almost now complete, got some bugs in it that I'm struggling with but i'll start another thread :-)

    Thanks again!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to combine these working parts??
    By transgalactic2 in forum C Programming
    Replies: 0
    Last Post: 02-01-2009, 08:19 AM
  2. Replies: 8
    Last Post: 04-25-2008, 02:45 PM
  3. Debug Error Really Quick Question
    By GCNDoug in forum C Programming
    Replies: 1
    Last Post: 04-23-2007, 12:05 PM
  4. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM
  5. Quack! It doesn't work! >.<
    By *Michelle* in forum C++ Programming
    Replies: 8
    Last Post: 03-02-2003, 12:26 AM