School project, remake of some useful C functions