Generally speaking you look for a library function called exit(), or _exit() or some variation. You could also look for library functions like doscall() or int86() which give access to a variety of OS services.
Functions like exit() are kinda like the roach motel, they can be entered but the never return.