在C \\ XNN转义序列 [英] The \xnn Escape Sequence in C

查看:219
本文介绍了在C \\ XNN转义序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读到这个转义序列, \\ XNN C 用于重新使用十六进制字符codeS或值present单个字符。我能得到这个转义序列的一个简单的例子程序,对于我不知道如何来实现它,因为我不是它的目的非常明确。


解决方案

  

我能得到这个转义序列的一个简单的示例程序


 的char * s =ABC;

也可以是codeD为:

 的char * s =\\ X61 \\ X62 \\ X63


  

我不是它的目的非常明确。


在除了可以容易地输入通常的字符,
在C11标准确定了以下的简单转义序列取值:

  \\'\\\\ \\\\?
\\ A \\ B \\ F \\ n \\ r \\ t符\\ v

如果一个字符不容易输入的,它不能被重新使用简单转义序列之一psented $ P $,你将有使用诉诸 \\ XNN (十六进制转义序列)或 \\ NNN (八进制转义序列)。

I read that this escape sequence, \xnn, in C is used to represent single characters using hexadecimal character codes or values. Can I get a simple example program of this escape sequence, for I'm not sure on how to implement it, for I'm not quite clear on its purpose.

解决方案

Can I get a simple example program of this escape sequence

char* s = "abc";

can also be coded as:

char* s = "\x61\x62\x63";

I'm not quite clear on its purpose.

In addition to the usual characters that can be typed easily, the C11 standard identifies the following simple-escape-sequences:

\' \" \? \\
\a \b \f \n \r \t \v

If a character cannot be typed easily and it cannot be represented by using one of the simple escape sequences, you will have to resort the using \xnn (hexadecimal escape sequence) or \nnn (octal escape sequence).

这篇关于在C \\ XNN转义序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆