/* poor programming practice */ temp = box_x1; box_x1 = box_x2; box_x2 = temp; temp = box_y1; box_y1 = box_y2; box_y2 = temp;
A better version would be:
/* * Swap the two corners */ /* Swap X coordinate */ temp = box_x1; box_x1 = box_x2; box_x2 = temp; /* Swap Y coordinate */ temp = box_y1; box_y1 = box_y2; box_y2 = temp;