Calling a shell script from a C program

Hi,

I have a shell script which connects to a database and fetches the count of the records from a table. I want to embed this whole script in a C program. Also the count fetched should be available in the C program for further usage.

Please let me know how this can be done.

Thanks