1) Escape sequences are mostly used for characters constants that either have a special meaning (such as “ or \ ) or for characters that can’t be represented graphically. Any character literal could be represented using hex ('\xhhhh') or unicode ('\0hhhh') escape sequences. Is there a situation where we should prefer using hex escape sequence over unicode escape sequence or vice versa?
2) When should we specify integer literals in hexadecimal form?
thank you
They are not interchangeable. You can only use a Unicode escape in an identifier name:
But in a string or char literal it doesn’t make a heck of a lot of difference. I prefer \u myself because the escape code has a fixed number of digits, \x is variable. But easy enough to avoid mistakes. Also note /U to pick codepoints from the upper planes.