whodunit.c:77:40: error: invalid digit 'f' in octal constant
if (triple.rgbtRed == 0000ff) whodunit.c:79:33: error: equality comparison result unused [-Werror,-Wunused-comparison]
CS50 Stack Exchange is a question and answer site for students of Harvard University's CS50. It only takes a minute to sign up.
Sign up to join this communitywhodunit.c:77:40: error: invalid digit 'f' in octal constant
if (triple.rgbtRed == 0000ff) whodunit.c:79:33: error: equality comparison result unused [-Werror,-Wunused-comparison]
Numbers starting with 0
are interpreted as octal (with digits 0-7). f
is not a valid octal digit.
For hexadecimal numbers, you would use for example 0x0000ff
. In this case, a 6-digit hexadecimal number makes little sense, as triple.rgbtRed
is a single byte (being fully described by 2 digits).
edit: Some background
0
for octal (that's what you accidentally had)0x
or 0X
for hexadecimal0b
or 0B
for binary - not available everywhere, C++14 standard includes it, C standard might follow)There are also postfixes telling the compiler the type of the number, like a u
for unsigned or l
for long, so that you might have a literal 0xCAFEBABEul
for an unsigned long int
of value 0xcafebabe