Link below picture. You even quoted it. Good job.Easy. Answer is C because
if D had seen two hats of the same color he would have known his own color. Not seeing two hats of the same color he cannot be sure what color his hat is. So C knows his hat must be different then the guy in front of him.
I've never understood why people bother to try and make something old look new. That joke was old when my dad first heard it during his campus days. Still good though.