“delete [] a,b; ” 的格式对吗?
“delete [] a,b; ” 的格式对吗?
程序:
int n=100;
int *a,*b;
a=new int [n];
b=new int [n];
delete [] a,b; //这样格式对吗?
[此贴子已经被作者于2006-10-13 10:26:30编辑过]
“delete [] a,b; ” 的格式对吗?
程序:
int n=100;
int *a,*b;
a=new int [n];
b=new int [n];
delete [] a,b; //这样格式对吗?
[此贴子已经被作者于2006-10-13 10:26:30编辑过]
为什么N在前面呢
恩,C里常用的是mallloc 和free();
没见过这种形式.
我只见过
delete []a; 这种形式
在哪见过,能举个例子吗?
在哪见过,能举个例子吗?
我在书上查到了,
delete [n] a;
delete [] a;
这两种格式都对,都是对动态数组的释放.delete [n] a;是比较老的写法.
书上说两种写法效果完全一样,