ok bankpro, fork is just a diversion from the main program. now you dont want it to return to main, then you do one thing, put the function part as a different program. and instead of calling the function, call "exec" function with the program name containing your function as the argument.
and since you want to make it run in background, you have to make the new program called in child using fork, as a daemon program.
I am sure you will find code snippets for a daemon program on the forum, if you do a search, if not check out this link
http://www.geocities.com/hemantborole/
click on KnowledgeBank, on the next page, click on C under My Programs, and in the list of programs, click on daemon.c to see the sample of the daemon process.