Global to local variables

I'm not sure what you mean, given that F has only local scope.

Maybe I'm not understanding

void setup() {Serial.begin(9600);}

void loop() {
byte F;
Serial.println(F);
F++;
delay(1000);
}

If I replace " byte F; " with " byte F = 0; " it still returns the same value of " 0 "

So how is "byte F; " not the same as " byte F = 0; " ?

demonstrating that it works in this case is not proof that this approach is correct

memory, including the stack is probably initialized to zero. F will be allocated on the stack. that location may be used and overwritten by another function called in the Arduino main() from which loop () is called

consider the following code which produces the following output

a: b  15089 - 0x8fa
b: x  15089 - 0x8fa
a: b -21287 - 0x8fa
b: x -21287 - 0x8fa
a: b   3114 - 0x8fa
b: x   3114 - 0x8f
char s [80];

void
a () {
    int b = random ();

    sprintf (s, "%s: b %6d - %p", __func__, b, &b);
    Serial.println (s);
}

void
b () {
    int x;

    sprintf (s, "%s: x %6d - %p", __func__, x, &x);
    Serial.println (s);
}

void
loop () {
    a ();
    b ();
}

void
setup () {
    Serial.begin (9600);
}

So whatever the controller assigns the variable in the memory stack, it's going to have that value that is in that address regardless if it is " 0 " or not. So it is kind of random of what value it will have. is that correct?

As of right now I have completely did away with the floats, one of the for loops, and "F". Still having the same effect I was looking for.