Monday 15 September 2014

c++ array[var][2] as a class member -


I have an array of unsigned integers within a square, and its size should be [var] [2], then user In order to be able to choose var.

  Unsigned integer (* * * * * * * *] hashFunc);   

and in the starting function:

  hashfank = new unsigned int * [var]; (Unsigned int i = 0; i & lt; var; ++ i) hashfank [i] = new unsigned complete [2];   

I just want to allocate once, and I think it should be possible in any way because I only have an unknown dimension (var is unknown, but 2 from the beginning I know).

Thank you!

(To answer the question directly.) You can declare as an indicator

  int (* hashfunk) [2];   

and assign it to one shot

  hashfank = new int [var] [2];    

No comments:

Post a Comment