resetting counter using bitwise XOR

Hi !
How to reset a variable to 0 after a reset value, say 10 using bitwise
XOR.

For example,

int cnt=0;

if(cnt<10)
cnt++;
else
cnt = 0;

How can we achieve this by using XOR only.

thanks,

Remember that any number, when bitwise XORed with itself will become 0.

if(cnt<10) {
   cnt++;
   fprintf(stdout,"cnt: %d\n",cnt);
}
else {
   cnt=cnt^cnt;
}

If you put this in a while(1), you'll get an infinite loop.