聘我网

新概念招聘3.0

c中\x代表什么?

vote up0vote downstar
char arr[]= "\xeb\x2a";

另外下面两个是否相同:

"\xeb\x2a" vs '\xeb\x2a'

 

1 个答复

vote up0vote downcheck

\x表示16进制。

"\xeb\x2a"表示字符串(character string),其中字符的ascii码值分别等于\xeb\x2a

'\xeb\x2a'是字符常量(character constant),int,值随端序(endian)而定。

An integer character constant has type int. The value of an integer character constant containing a single character that maps to a single-byte execution character is the numerical value of the representation of the mapped character interpreted as an integer. The value of an integer character constant containing more than one character (e.g.,'ab'), or containing a character or escape sequence that does not map to a single-byte execution character, is implementation-defined.

链接

您的回答





不是您要找的问题? 浏览其他含有标签 的问题或者 自己问个.