The proper way to denote hex, or base 16, is to prepend 0x
Conversely, what is the proper way to denote decimal/base 10?
The proper way to denote hex, or base 16, is to prepend 0x
Conversely, what is the proper way to denote decimal/base 10?
In mathematical numeral systems, the radix or base is the number of unique digits, including zero, used to represent numbers in a positional numeral system. For example, for the decimal system (the most common system in use today) the radix is ten, because it uses the ten digits from 0 through 9.
In any positional numeral system (except unary, where the radix is 1), the number x and its base y are conventionally written as
, although for base ten the subscript is usually assumed and not written, as it is the most common way to express value. For example,
(in the decimal system) represents the number one hundred, whilst
(in the binary system with base 2) represents the number four.
Source Radix
The 0 and 0x prefix are the C programming language's way of expressing octal/hex, and has become popular due to the popularity and ubiquity of C. That convention itself may have come from earlier languages or conventions.
Various other standards for expressing have been used over time. 6502 assembly prefixed hex with a $. In a lot of Z80 and early x86 assembly, you'll see a trailing H. Some dialects of BASIC used an & or something like &H.
So this is going to be specific to the programming language you are working with. Many languages, especially ones created since the late 80's or so use C's standards for things. Outside of a programming language context, you should probably use mathematical notation standards or write a word denoting the base ("base 10" or "decimal") if there could be confusion.
I really, really do like the answer from Ramhound's comment. If you simply don't specify a base, the general assumption is that it is base 10.
If you want to be very explicit, you could use HTML "5<SUB>10</SUB>" (or "5<sub>10</sub>" for those who prefer lowercase HTML) to be rendered as "510". In text, you can use "5 base 10".
Note that 0x is not a universal way to specify hexadecimal. The 0x prefix is used by the language of C, and other languages similar to C. In typical x86 assembly, one uses an H suffix (so 0x768 in C is the same thing as 768H in x86 assembly). Embedded programming: numbers says that the H suffix is for "Intel and TI assembly language". That same web page notes that for "Freescale assembly language", the syntax is to prepend a dollar sign ("$768").
In all of these languages (C, Intel Assembly, and Freescale assembly), the syntax for a base 10 number is to just specify the number, with no special text needed to be prepended or suffixed.
Other methods could be used (like adding an underscore followed by a radix value, which may be easier to type than relying on using subscript font rendering), or you could use any other custom method that you describe at the start of your writing/lecture/whatever, but ultimately, if you don't specify something specific, then people will be inclined to use their assumptions.
Part of communication is to know your audience. (That's basic communication theory, not limited to specifically computers.) If your audience includes a bunch of C programmers, then 0x just implies hexadecimal. If your audience doesn't, then 0x768 looks like a multiplication problem, and equates to zero. If you're interacting with a group of people who are familiar with a particular syntax/language/convention, then use what they are familiar with.
The art of computer programming is basically a way to communicate the ideas of what you want a computer to do. The best way to communicate is generally to use what the audience expects. And, as you can see from multiple comments here, the general tradition is to just assume base 10 unless there is an indication (like a notation like "0xblah") or other reason (like context) to believe that the base is something else.
Just as another example thrown out there: if I see 99-10-12-16-23-20, then I don't automatically start thinking "18". I start to think that looks like a MAC-48 address of a network card, written in the format used by IEEE's OUI list and Microsoft Windows (and not Unix)... interesting that it has no digits that are exclusively hexadecimal. But if I was expecting a network address, then I would probably assume that those are likely hexadecimal digits.
I have seen instructors of college level courses will sometimes want to write a bunch of numbers and be very clear about the bases. In those (not incredibly common) situations, what they typically did is use the subscript notation, unless they knew that there handwriting was sloppy, in which case they would also add some parenthesis as shown by the answer given by DavidPostill.