Passing C Variable To Unix

I want to pass a variable set in my c program to a shell script (which will also be invoked or initiated from the same C program using the C's system command). Is it possible ?

:confused:

Use putenv() to put the variable in the environment before you call system(). Then the shell can pick it up out of the environment.

You can simply use system() like...

main()
{
char myarg[] = "Whatever"; // variable set here
...
...

sprintf(mycmd, "%s %s", "myshell", myarg);

system(mycmd);

}

You can use system(3) like this, eg.
system("LC_ALL=zh_CN date");