Mail Archives: djgpp/1996/12/13/02:53:28
Jean-Gaël GRICOURT <jean-gael DOT gricourt AT snet DOT net> wrote:
>I can't figure out what's wrong with this, I got an error
>(General protection fault) when I ran it.
>I used DJGPP V2.
>
>
>#include <iostream.h>
>#include <stdlib.h>
>
>// Compile with DJGPP ->
>
>class Myclass {
>
> int **mem;
> int i,j;
>
> public:
> Myclass(int=0,int=0);
> ~Myclass();
>};
>
>Myclass::Myclass(int i0,int j0)
>{
> int x;
>
> i=i0;j=j0;
>
> *mem=new int[i];if(*mem==NULL) { cout<<"no memory\n";exit(1); }
Shouldn't this be: mem = new int * [i] ; //etc
Adrian.
- Raw text -