compiler says I have to declare my hexidacimal I try to compare
Nothing here that hasn't been covered in comments already but just putting it in the form of an answer to save digging...

How is the compiler supposed to know that a number is hex rather than decimal?

Sure 1234beef is obviously hex but what about 12345678? Is that hex or decimal?

You need some method for the compiler to know.

You also need some way for the compiler to know if something is a number or a variable. Take the code if (x == deadbeef) {...} is deadbeef a hex number or a variable name?

C uses a very simple convention. If it starts with a number it's a number, if it starts with a letter it's a variable. This is why variable names can contain numbers but can't start with them.

If an integer starts with an 0 e.g. 0123 then it's in octal.
If an integer starts with 0x e.g. 0x123 then it's in hex.
If an integer starts with something other than a 0 e.g. 123 then its in decimal.

e.g.

printf("123 = %d\r\n0x123 = %d\r\n0123 = %d\r\n", 123 , 0x123 , 0123);


returns

123 = 123
0x123 = 291
0123 = 83


This convention, especially the 0x prefix for hexadecimal, is very widely used in other programming languages.