If it's anything like Linux (I haven't used MINIX, so I don't know exactly sorry), you write something like this:
Code:
#include<unistd.h>
#include<stdio.h>
int main(int argc, char* argv[]){
if(fork()){
printf("I'm the parent!\n");
return 0;
}
else{
printf("I'm the child");
/*daemon loop here*/
}
return 0;
}
What this does is spawns a new child, and then the parent exits. The now orphaned child process is 'adopted' by init and continues to run. I think there's also a function actually called daemon(), but I've never used it so I can't be sure.
EDIT: Ahh, there is indeed a non-standard function (from BSD4.4 it looks like) called daemon(). It takes two integers, the first is whether or not to change the working directory to / and the second whether or not to pipe all output to /dev/null. It isn't part of POSIX, though, so for portability don't use it