我在删除数组时遇到问题
int calc_mode (vector<int> array, int arrSize) {
int ipRepetition = new int[arrSize];
int j;
bool bFound;
for(int i =0; i<arrSize; i++) {
ipRepetition [i] = 0;
j=0;
bFound = false;
while ( j<i && array[i] != array[j] ) {
if(array[i] != array[j]) {
++j;
}
}
}
int iMaxRepeat = 0;
for(int i =0; i<arrSize; i++) {
if(ipRepetition[i] > ipRepetition[iMaxRepeat] ) {
iMaxRepeat = i;
}
}
delete [] ipRepetition; //compiler is complaining here
return array[iMaxRepeat];
}
错误:无法删除'ipRepetition' ....你能指出我错过了什么吗?