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?

1 Answer 1


In Arduino AVR Boards, HIGH and LOW are currently macros:


#define HIGH 0x1
#define LOW  0x0

This means that sizeof(HIGH) is equivalent to sizeof(0x1). 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).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.