I don't know whether it helps you or not.
There is a function called system() which is used to issue a shell command.
int system(const char *string);
string is the command.
int system("cc sample.c -o sample");
Then you will get an executable sample.