include stdlib.h for malloc, free, abs