I've been bashing my head for a bit, and I've discovered something confusing. I have been assuming the int type has a size of 2 bytes and I've discovered that it's 4. is this correct? Here is a small program showing the head scratcher. Normally, short and int have the same 2 byte size.
Comments?
Comments?
Code:
/*
Teensy 3.5 Output
Show Integer and Float Data Sizes
long long is 8
long is .... 4
int is ..... 4 <-- I expected 2, why 4?
short is ... 2
char is .... 1
double is .. 8
float is ... 4
*/
void setup()
{
Serial.println("Show Integer and Float Data Sizes\n");
Serial.print("long long is "); Serial.println( sizeof(long long) );
Serial.print("long is .... "); Serial.println( sizeof(long) );
Serial.print("int is ..... "); Serial.println( sizeof(int) );
Serial.print("short is ... "); Serial.println( sizeof(short) );
Serial.print("char is .... "); Serial.println( sizeof(char) );
Serial.print("double is .. "); Serial.println( sizeof(double) );
Serial.print("float is ... "); Serial.println( sizeof(float) );
}
void loop()
{
}