Actually it's a hackerrank problem, the lonely integer. I understand the XOR logic used here. I just couldn't understand deeply the concept how is every number being processed after input. I have marked the line in code. Please help me in understanding it.
#include <iostream>
using namespace std;
int main()
{
int n, a, c = 0, i;
cin >> n;
for (i = 0; i < n; i++)
{
cin >> a;
c ^= a; // THIS LINE .... i WANT TO KNOW HOW IS THIS WORKING ?
// HOW IS COMPARISON BEING CARRIED OUT HERE ?
}
cout << a << endl;
return 0;
}