Link to home
Create AccountLog in
Avatar of sydneyguy
sydneyguyFlag for Australia

asked on

c++ int** what is it and what does it do and why would i use it and a good reference reading on the subject

easy question
what is  int** doing have been looking for it on the net and have not found it any were.
is this a pointer to a pointer or some thing like that


int height = 15;
      int width = 10;
      int** my2DArray = create2DArray(height, width);
      printf("Array sized [%i,%i] created.\n\n", height, width);

Open in new window



here is the calling function

    int** create2DArray(unsigned height, unsigned width)
    {
      int** array2D = 0;
      array2D = new int*[height];

      for (int h = 0; h < height; h++)
      {
            array2D[h] = new int[width];

            for (int w = 0; w < width; w++)
            {
                  // fill in some initial values
                  // (filling in zeros would be more logic, but this is just for the example)
                  array2D[h][w] = w + width * h;
            }
      }

      return array2D;
    }

Open in new window

Avatar of ozo
ozo
Flag of United States of America image

pointer to pointer to int
SOLUTION
Avatar of Karrtik Iyer
Karrtik Iyer
Flag of India image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of sydneyguy

ASKER

thanks for all you great help i though that thats what it was but the explanation helped so much
thanks again