A
alohahulaland
Hi,
I got crash with the following code (damage: after normal bloack
(#45)):
char* s=new char[3];
*s='a';
s++;
*s='b';
s++;
*s='c';
s++;
*s='\0';
delete [] s;
Question 1: Is it legal to delete s before moving it back to the
beginning?
then I try this, still got the same crash:
char* s=new char[3];
*s='a';
s++;
*s='b';
s++;
*s='c';
s++;
*s='\0';
s--;
s--;
s--;
delete [] s;
any idea why?
I got crash with the following code (damage: after normal bloack
(#45)):
char* s=new char[3];
*s='a';
s++;
*s='b';
s++;
*s='c';
s++;
*s='\0';
delete [] s;
Question 1: Is it legal to delete s before moving it back to the
beginning?
then I try this, still got the same crash:
char* s=new char[3];
*s='a';
s++;
*s='b';
s++;
*s='c';
s++;
*s='\0';
s--;
s--;
s--;
delete [] s;
any idea why?