Variables declared within functions, by default, are stored in memory data location. However, there are following few caveats:
- The location for value type variables is memory within a function while the default for a reference type variable is storage.
- By overriding the default location, reference types variables can be located at the memory data location. The reference types referred are arrays, structs, and strings.
- Reference types declared within a function without being overridden should always point to a state variable.
- Value type variables declared in a function cannot be overridden and cannot be stored ...