This might be a stupid question to ask but I'm curious. I decided to test this myself and I got a value of 2 for both HIGH and LOW, why would it output 2?
In Arduino AVR Boards, HIGH and LOW are currently macros:
#define HIGH 0x1 #define LOW 0x0
This means that
sizeof(HIGH) is equivalent to
0x1 is an integer constant. The default type of integer constants is int. On an 8 bit microcontroller like the ATmega2560 used by your Arduino Mega, an int is 16 bits.
That is why
sizeof(HIGH) returns 2 (16 bits / 8 bits/byte = 2 bytes).