Milena Constantino Caires
2005-07-20 14:45:55 UTC
I would like to know why the following statements do not generate a
error during compiling but they do generate segmentation fault and
core dump when the program is running:
char* c = new char(1024);
or
u_char* c = new u_char(1024);
I know that the correct form of this memory allocation is "[1024]" and not
"(1024)" but sometimes it occurs by mistake.
The compiler is not supposed to complain about it???
Thanks in advance,
Milena
error during compiling but they do generate segmentation fault and
core dump when the program is running:
char* c = new char(1024);
or
u_char* c = new u_char(1024);
I know that the correct form of this memory allocation is "[1024]" and not
"(1024)" but sometimes it occurs by mistake.
The compiler is not supposed to complain about it???
Thanks in advance,
Milena