Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

Parveen Kaler

Dynamic MultiDimensional array in class

This topic is 6200 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I used to remember how to do this the *correct* way. I left my copy of Effective C++ at home today. But is this the correct way to allocate a multidimensional array in a class?
class A
  A(unsigned int x,unsigned int y)
    m_nx = x;
    m_vArray = new float*[x];

    for(int i = 0; i < y; i++)
      m_vArray[i] = new float[y];

    for(int = 0; i < m_nx; i++)
      delete []m_vArray[i];

    delete []m_vArray;
  float  **m_vArray;
  int    m_nx;
Edited by - Parveen Kaler on July 30, 2001 1:21:18 PM Edited by - Parveen Kaler on July 30, 2001 2:04:31 PM

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!