Is it possible to compare a element with each element in array except itself in c++? -


like if array have 5 elements. need compare element elements of array except element comparing every element. , rule applied on comparing each , every elements of array.
example- let's have array of 5 elements-{8,12,15,6,9}. suppose comparing element 3 i.e 15 want know possible compare 15 elements of array except 15 itself? if yes how? newbie in programming , sorry bad english too.
great if provide code :)
thank in advance.

edit 1- comparison done if array have multiple unequal values.

in loop or other loop add if statement execute rest of problem if both values not match.

int arr[] = {8,12,15,6,9}; const int elem = 15; const int length = sizeof(arr)/sizeof(int); for(int = 0;i < length ;i++) {     if(arr[i] != elem) {             //rest of code     } } 

Comments