You can return at least an exit status from the script to the main C code (usually 0 or -1 for success/fail). Not sure about more than that.
Absolutely. Those and MANY more.
In the helpview type in ‘ksh’ for the Korn Shell (which is the one I assume you are using). It brings up very detailed info on the script commands you can use, what can be returned and some examples of how to do it. I didn’t read it all (it’s a large section) but the answers you want are definitely there.
There are a lot of kludgy ways to return information from a script to the calling ‘C’ program.
The simplest I can think of, is to write a file in the shell script and read it from your ‘C’ program after the shell script returns. You could skip the file by creating a pipe in the ‘C’ program, and making the output from the script the pipe. There is nothing inherent like global data, or passing pointer references.