bug or error in the program

Alexandre Oliva oliva@dcc.unicamp.br
Wed Sep 30 23:48:00 GMT 1998


Jinpeng Xie <xie@nu.cs.fsu.edu> writes:

> I use "array = new char *();" to allocate memory first,
> for each line, I use "array[i] = new char[length]" to allocate memory.

This just allocates space for 1 pointer to char, which is not enough
what you want.  You need `new char*[N]', where `N' is some upper bound 
to the number of pointers to char you'll want to store there.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil




More information about the Gcc-bugs mailing list