Incorrect. What if both A and B are NULL? Then this function computes B->head, which causes a memory fault.