Remake of C function printf, from school 42