Problem with char*


Does anybody knows that might trigger a breakpoint here

1
2
3
4
5
6
7
8
9
10
11
char * arr;
int t;
int length;

Stack(int a)//stack of characters
{
length=a;
arr=new char[length];//Here the program breaks 
//if (void* const block = malloc(size)) exception
t=-1;
}

Last edited on
Print out the value of length before you try new char[length] ;
Topic archived. No new replies allowed.