Mayday Programming Brain Teaser

Thanks to Sam for the idea.

int k = 0;
k = k++;

After both lines execute, what is k equal to?

Apparently, the answer depends on a number of things. In Java, k is 0. In C, it may be 0 or 1 depending on your compiler!

Bonus points if you can explain why.