C Example working optimally