Various useful C codes