I was just wondering what would happen if I did something like this:
int main()
{
char *foo;
foo = new char[200];
//do stuff with foo
delete foo;
}
Since foo is allocated as an array, I know that I should use the array delete[]
, but what would be the effect of the above code? Could this cause a memory leak or some sort of other bad behavior?