   Problem with dynamic array
  I am writing my first SDL game (and my first program with c++) and I have got a problem with this code (I had simplified so much) :class badBoy {  private:    SDL_Surface **badDraws;  public:    badBoy (int number) { *badDraws = new SDL_Surface[5]; badDraws[2] = SDL_LoadBMP("badBoy2.bmp");    }};int main () {badBoy* a = new badBoy (5);}This code compile but when I run the program I get a segmentation fault. The problem is the dynamic array. Which is the good way to make this? 
  The reason why you get the seg-fault is that you access a pointer which is not initialized and therefore points into the nirvana.char** PtrToPtr;*PtrToPtr = SomeValue; // Error!!!  In the second line you dereference the pointer which isn''t initialized. ;  Think more about why you want (or more likely, don''t want) a double-pointer here. ;  if you are creating a 2D map or grid, you need to create each pointer array, then each pointer in each of those arrays. A two step process.if you are not creating a grid, why on earth are you using a pointer-pointer?   [edited by - leiavoia on February 12, 2004 12:07:50 AM];  should readyour** = new yourtype*[5];your[2] = somepointer; ;  Thanks rebelcoder. That was the solution. 