Leading 0 makes the constant an octal value (base 8).
In this case, it does not differ from 1 or 0x1 , because all of them will have the same binary representation 000...001 . People often use hexadecimal constants to distinguish that a value is used as a bitmask or other bitwise value today. Previously, octal constants were used more often for the same purpose.
0x1 = hex constant = 1 0X1 = hex constant = 1 01 = octal contant = 1 1 = decimal constant = 1 1U = unsigned decimal constant = 1
source share