Variable value on declaration, when/where is the code run?

Hi all!

Please note the following code.

char aNumber = 15;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println(aNumber++);
  delay(1000);
}

Personally i prefer to set a value in setup(), but I see similar code to this example everywhere. My question; aNumber is set to 15 outside any function. So where/when does the code (aNumber = 15) actually run?

crt0

TheMemberFormerlyKnownAsAWOL:
crt0

Thank you :slight_smile: