Hello, I am trying to figure this:
int tmpT;
char str[10];
tmpT = (int)bmp.readTemperature();
sprintf (str, "%i", tmpT);
Serial.print("tmpT: ");
Serial.println(tmpT);
Serial.println(sizeof(tmpT));
Output #1:
tmpT: 31
4
int tmpT;
char str[10];
tmpT = (int)bmp.readTemperature()*-1;
sprintf (str, "%i", tmpT);
Serial.print("tmpT: ");
Serial.println(tmpT);
Serial.println(sizeof(tmpT));
Output #2:
tmpT: -31
4
I would have thought that the Output for #1 should have been 31 with the sizeof
being 2. And for Output #2, -31 with the sizeof
being 3.
Can somebody tell me why both show a size of 4?
Thanks
Eric