It's resetting millis(), but not just millis(). It's clobbering something in RAM, and resetting the Arduino.
Jack Christensen is right, sizeeof(something) is 40.
Have a look at this...
unsigned long something[10]; // something array
int printDelay = 1000;
int count = 0;
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(115200);
Serial.println("");
Serial.println("In setup()");
}
// the loop routine runs over and over again forever:
void loop() {
Serial.println(millis());
count++;
delay(printDelay); // delay
Serial.print("count = ");
Serial.println(count);
if (count == 5){
clearSomething();
}
}
void clearSomething() {
for (byte thisThing = 0; thisThing < 10; thisThing++) {
Serial.print("thisThing = ");
Serial.println(thisThing);
something[thisThing] = 0;
}
Serial.println("Cleared.");
}
If that for iterates to sizeof(something), it exceeds the bounds of the array. Try changing it to that, and you'll see that thisThing counts to 8, then you end up back in setup().
Why 8? Because there is no delay in the clearSomething() function, and thisThing is well past the end of the array before another Serial.print() has a chance to show up on your serial monitor.