nicholas.masson:
To lay out a few questions for succinctly:
- when a variable is declared locally in a function, is it written from flash to RAM, used, then wiped out afterwards
- do global variables reside in RAM whenever the program is running
- all variables must be written in flash somewhere, right? RAM does not persist when the power is off, so I assume that at bootup variables are written from flash to RAM
- When you use a function like Serial.print("Hello World"); is the string "Hello World" created as a global variable string that persists in RAM? Or is it created when the function is called, then wiped out of RAM after it is used?
- No. It occupies space on the stack, which is in RAM, for the life of the function call.
- Yes.
- Yes.
- The string "Hello World" is created as a global variable string that persists in RAM