如果你没有对malloc使用适当类型的删除会发生什么?

时间:2014-05-21 23:34:03

标签: c++ c memory-management memory-leaks

我只是想知道如果我这样做会发生什么:

int main()
{
  char *foo;
  foo = new char[200];
  //do stuff with foo
  delete foo;
}

由于foo被分配为数组,我知道我应该使用数组delete[],但上述代码会产生什么影响呢?这会导致内存泄漏还是某种其他不良行为?

0 个答案:

没有答案