Arduino script and SD card library?

nicholas.masson:
To lay out a few questions for succinctly:

  1. when a variable is declared locally in a function, is it written from flash to RAM, used, then wiped out afterwards
  2. do global variables reside in RAM whenever the program is running
  3. 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
  4. 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?
  1. No. It occupies space on the stack, which is in RAM, for the life of the function call.
  2. Yes.
  3. Yes.
  4. The string "Hello World" is created as a global variable string that persists in RAM