C Algorithm implementaiion Best Practice