Call by reference question
I have a question regarding call by reference - essentially using a function i made and calling it in the main function. I'm passing 2 variables (pointers) into it and the value is copied in the corresponding function but the variable itself is not changed in the calling environment (main).
void somefunction(arg1, arg2, arg3, arg4, *ans1, *ans2)
// function does some arithmetic and spits out 2 output values/variables *ans1 and *ans2
NOT SHOWED is the header file that has the function prototype etc
int = arg1, arg2, arg3, *ans1, **ans11;
double = arg4, *ans2; **ans22
ans11 = &ans1
ans22 = &ans2
timediff(arg1, arg2, arg3, arg4, *ans1, *ans2);
printf("answers are %d and %d", ans11, ans22);
I didn't copy my program in but made a close generic approximation version of it... hopefully that can help a little...
Thought the best way to do it is try and use a pointer to a pointer...