C1854: Returning address of local variable

[WARNING]

Description

An address of a local variable is returned.

Example
  int &f(void) {

  
    int i;

  
    return i;   // warning

  
  }

  
Tips

Either change the return type of the function to the type of the local variable returned, or declare the variable to be returned as global (returning the reference of this global variable)!