That will work too, just exit() will not.
The function (found in stdlib.h) is void exit(int), i.e. it takes exactly one integer, which is returned as the exit code of your program (0 is standard for "no error"). The function does not return, obviously.