Inverse use of "giving variables" to functions

Hi, i know about calling a function and give the function some variables to work with

eg

setLeds(0,1,0);


void setLeds(int led1,int led2,int led3) {

digitalWrite(1,led1);
digitalWrite(2,led2);
digitalWrite(3,led3);
}

Now i wonder if it would possible to give the function a few variables TO FILL, like getVars(VarTemp,VarVoltage,VarTime);

And then do all the processing in the function.
It would be important that the "given" variable is filled (no hardcoding a variable in the function)

Can this be done?

Sure, just pass them in "by reference" if you want them to be modified by the function. Just add the ampersand:

void setLeds(int & led1,int & led2,int & led3)
{
  digitalWrite(1,led1);
  digitalWrite(2,led2);
  digitalWrite(3,led3);
  int temp = led1;
  led1 = led2;
  led2 = led3;
  led3 = temp;
}

Cheers,
/dev