Perhaps you are trying to pass the value back through the parameter list. By default, C and C++ always pass the function parameters by value, meaning that if they are modified within the function, those modifications are local. For instance, if you have the function foo:
Code:
void foo(int arg1, int arg2) {
arg1=2;
...
}
And you call it from the main routine like so:
Code:
int a=3;
foo(a, 5);
printf("%d\n", a);
you will get 3, not 2, as the result. There are two ways to pass by reference, one of which is a C++ extension. The old, C way of doing things, is:
Code:
void foo(int *arg1, int arg2) ...
Now you have to call it like this:
Code:
int a=3;
foo (&a, 5);
The newer, C++ way is:
Code:
void foo(int &arg1, int arg2) ...
in which case you can continue to call it in the usual way as in the very first example.
Hope this helps.