As u havent included any example I would suppose the situation is as
follows:
///////////////////////
int global;
void do_change(int x, int y)
{
x = y;
return;
}
int main()
{
...
do_change(global,100);
...
/* oops global is still unchanged = 0 */
}
/////////////////////////////
Am I right? If so just change do_change to
void do_change(int* x, int y)
{
*x = y;
return;
}
and call it with
do_change(&global,100);
...in the first example parameter X is passed by value (i.e. your function
works with a local copy of the actual object) so the global variable is
still unchanged after the execution
Regards,
Marin
-----Original Message-----
From: Ravindra Jaju <[EMAIL PROTECTED]>
To: Linux C Programming <[EMAIL PROTECTED]>
Date: 05 Септември 1998 г. 20:37
Subject: Global variables
>Hi!
>Please tell me how to use global variables!
>
>I am using a program which in which I define a variable before the main
>function so that the functions after it can access and change it.
>
>But the changes I make to the global (??) variable aren't refrected in the
>main part of the program.
>I have tried the static identifier tag as well, but it doesn't work out.
>Please help.
>
>Thanx!
>
>Regards,
>Ravindra Jaju
>