Results 1 to 4 of 4

Thread: --also--

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2002
    Location
    Duluth, MN, US
    Posts
    20

    --also--

    Speaking of 2-d arrays on the last topic, does anyone know a simple way to create a dynamic 2-d array?

  2. #2
    Guest

    Re: --also--

    ha ha ha ha ha ha

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: --also--

    Here's a piece of code to create a 20x30 array dynamically.
    Code :
    char **dynamic2DArray;
    dynamic2DArray = new char *[20];
    for(int i = 0; i < 20; ++i)
    {
        dynamic2DArray[i] = new char[30];
    }
    You access it as dynamic2DArray[x][y], where x is between 0 and 19, and y between 0 and 29.

  4. #4
    Junior Member Newbie
    Join Date
    Jan 2002
    Location
    Duluth, MN, US
    Posts
    20

    Re: --also--

    Thanks Bob. That is very useful information.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean