But here's the question.
When a variable type int is assigned a # that is not type int via math, what does ATtiny85 do with it.
Two examples, the 1st we expect the serial monitor to show "2" every one sec.
The 2nd example, does it balk on the variable assignment, or does the mcu truncate to type integer? Or does it change to type float and round() keeps one decimal spot?
Ex #1 [4/2=2]
Code: Select all
int X = 4/2;
void setup() {
Serial.begin(9600);
}
void loop() {
round(X);
Serial.println(X);
delay(1000);
}
Ex #2 (does it print "1" or "1.0") [4/3=1.333333333333333333]
Code: Select all
int X = 4/3;
void setup() {
Serial.begin(9600);
}
void loop() {
round(X);
Serial.println(X);
delay(1000);
}