added -Wall and -g flag
moved function declaration to c file
removed compiler warnings