Problem with global and local variables

Guys, how can I define global variables in sorlaris...cause I lose the values outside the scope.

Rite now wat I do is,I redirect variable value to a file n then get it back outside the function...:o....theres obviously a better way of doing this...I now this is a basic question....but please help.....

Are you talking about C?

int this_is_global=0;

void foo(void)
{
    this_is_global=7;
}

int main()
{
      printf("before: %d ", this_is_global);
      foo();
      printf(" after: %d\n", this_is_global);
}

Is it shell script? - the syntax depends on what shell you are using

echo $SHELL

will show you your shell. We need to know which shell you are using.

or better yet - to get the 'active' shell interpreter:

echo $0