Call function within function?

I was wondering is it possible to change the input of a function by calling that function within itself. eg

void setup()
{
  Serial.begin(9600);
  test(1,1);
}

void loop() 
{

}

void test(int val_1, int val_2)
{
  test(2,2);
  delay(100);
}

If this function is called once will it run infinitely? If it had a return type would it ever stop returning?

What you are doing is possible but is seriously bad practice unless you know what you are doing and have a reason to do it. Google recursion.

Perhaps it would be better if you explained what you are trying to do and why you think that recursion is needed.

romarshmallow:
I was wondering is it possible to change the input of a function by calling that function within itself. eg

In addition to what @UKHeliBob said, if I take your question literally, the answer is NO.

If you call a function with the values (say) 2 and 3 - as in myFunc(2,3); there is no way to change either of those values by using the function to call itself. It could, of course, ignore the values it was given.

If the values the function is working with are global values there would be no need to pass them as parameters and the function could then change the global values. For example

int valA = 6;
int valB = 123;
int valC = 0;

void myFunc() {
   valC = valA + valB;
   valA += 1;
}

…R

UKHeliBob:
Google recursion.

Yeah, I did that, and it sent me to the definition for recursion. When I clicked on it, I ended up back in the same place!

That reminds me of the famous dictionary definition

Recursion

Noun

See recursion