Do you know how to get function value in Arduino?

Hi! A few days ago, i learned arduino can't get a value from a function.
I want to programming in arduino like this code.

void f(int n)
{
      //code
}

Do you know how to get function value in Arduino?

If you declare the function to return void then you can't get a returned value from the function.
Declare it to return int and then you can return an integer value.

int f(int n)
{
  int result;
  // calculate value of result
  return(result);
}

A few days ago, i learned arduino can't get a value from a function.

Really? I've been doing it for decades. For example:

void setup() {
  // put your setup code here, to run once:
  int number = 10;
  int result;

  Serial.begin(9600);
  result = SquareANumber(number);
  Serial.print("The square of ");
  Serial.print(number);
  Serial.print(" is ");
  Serial.println(result);

}

int SquareANumber(int val)
{
  return val * val;
}

void loop() {

}

The function, SquareANumber(), returns the squared value of the number passed into the function (val). The type of value returned is determined by the function type specifier, which is the data type that preceeds the function name; int in this example. While a function can only return a single value, it can change values by using pointers, but that's another topic.

int f(int n) {
     return 42+n;  // Note 'return' is a statement, not a function.  No "()" needed.
}

void loop() {
   Serial.println(f(12));  // Displays "54" on Serial Monitor
   delay(5000);
}

thanks to everybody! The problem has been solved!