Thread: operator overloading and dynamic memory program

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    The Pantless Man CheesyMoo's Avatar
    Join Date
    Jan 2003
    Posts
    262
    Okay, you sure are asking alot, I'll help with a litte.

    Code:
    // Dynamically allocating memory
    
    private:
    char *pointer; // Pointer to string
    ...
    
    // Constructor
    MyInt(char Int_String[], int size)
    {
       int i = 0;
    
        pointer = new int[size];
        pointer = Int_String;
    
    
        while(Int_String[i] != 0)
         {
            if(isDigit(Int_String[i]))
              {
                *pointer = "0";
                break;
              }
          }
    }
    Something like that for dynamic memory allocation, you just have empty functions, give it a try!
    Last edited by CheesyMoo; 04-09-2003 at 01:52 PM.
    If you ever need a hug, just ask.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Heap corruption with dynamic memory
    By Head In Jar Man in forum C++ Programming
    Replies: 8
    Last Post: 01-14-2009, 02:58 AM
  2. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  3. Issues with free and dynamic memory
    By dan s in forum C Programming
    Replies: 3
    Last Post: 01-14-2007, 03:44 AM
  4. Inheritance and Dynamic Memory Program Problem
    By goron350 in forum C++ Programming
    Replies: 1
    Last Post: 07-02-2005, 02:38 PM
  5. Dynamic Memory Allocation for fstream (binary)
    By kuphryn in forum C++ Programming
    Replies: 2
    Last Post: 12-12-2001, 10:52 AM