For compiling a c program on your latest macOS just type the following in terminal after saving the file with a .c extension and on reaching the path where the file is saved :
cc yourfilename.c
Once you have checked all the errors after compilation (if any), type the following for executing the code :
./a.out
These commands are tested on macOS Mojave and are working perfectly fine, cheers coding!