How do you initialize special ASCII chars, for example EOT (0x04), ENQ(0x05)?
char CHAR1 = '\EOT';
char CHAR2 = '\ENQ';
Is this correct?
You can put character code into the variable:
char CHAR1 = 4;
char CHAR2 = 5;
You can also use escape sequences which you'll find here .
By hex or octal, there is no support for their names. '\\x04'
eg.
You can simply assign char to its hexadecimal value:
char CHAR1 = 0x04;
Is this correct ? - no the way you initialize it is not correct as compiler expects one escape character after '\\'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.