首页 > c++中反斜杠'\'的问题

c++中反斜杠'\'的问题

#include <iostream>

using namespace std;

int main()
{
    cout << (int)'\1' << endl;
    cout << 1 << endl;

    cout << (int)'\11' << endl;
    cout << 11 << endl;

    return 0;
}

请问,(int)'11'这样输出为什么是9啊?


转义序列

有五种类型的转义序列:简单、八进制、十六进制、Unicode (UTF-8) 和 Unicode (UTF-16)。转义序列可以是以下任一项:

可以参考 字符串和字符文本 (C++)

【热门文章】
【热门文章】