0

Hello , I want to compare each element of an array with every other.

For example, array[0] with array[1] , with array[2] ...

Then , array[1] with array[2],with array[3] ...

So , I thought something like this :

```
for ( int i = 0; i < N; i ++ )
{
for ( int k = i + 1; k < N; k++ )
{
temp[ i * N + k ] = (array[ i ] == array[ k ]);
}
}
```

But , for example , for i = 0 , temp indexing will be : temp[ 0 + 1] ,hence temp[ 1] .

There will not be temp[ 0 ] as first index!

I can't think how to solve this and also what the size of temp will be.If I leave it as N * N ,it will cover all cases but it is more than it is needed.

Thanks!