#include<iostream>
using namespace std;
void RemoveSame
(
int b[],
int nLen,
int res[],
int nLenRes
)
{
nLen = 0;
for (int i = 0; i < nLen; i++)
{
bool bExist = false;
for (int j = 0; j < nLenRes; j++)
{
if (b[i] == res[j])
{
bExist = true;
break;
}
}
if (bExist)
continue;
res[nLenRes] = b[i];
nLenRes++;
}
}
int main()
{
int b[8] = { 0,1,2,2,4,5,7,5};
static int nLenRes;
int res[99];
RemoveSame(b, 8, res, nLenRes);
for (int i = 0; i < nLenRes; i++)
cout << res[i] << endl;
return 0;
}
数组去重代码,为什么运行完什么都出现不了