Advertisement
Guest User

Untitled

a guest
Feb 5th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1.  
  2. const int width = 100;
  3. const int height = 100;
  4.  
  5. int **array = (int**)malloc(sizeof(int*)*height);
  6. int *data = (int*)malloc(sizeof(int)*width*height);
  7.  
  8. for (int x = 0; x < height; ++x) {
  9.     array[x] = &data[x*width];
  10. }
  11.  
  12. array is now accessible through array[0 through 99][0 through 99]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement