Bitwise Operators in C / C ++ |  ; Function to return the only odd occurring element ; Driver Method
#include <iostream> NEW_LINE using namespace std ; int findOdd ( int arr [ ] , int n ) { int res = 0 , i ; for ( i = 0 ; i < n ; i ++ ) res ^= arr [ i ] ; return res ; } int main ( void ) { int arr [ ] = { 12 , 12 , 14 , 90 , 14 , 14 , 14 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << " The ▁ odd ▁ occurring ▁ element ▁ is ▁ " << findOdd ( arr , n ) ; return 0 ; }