C语言 在程序中误入“\303”和“\215”——为什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22384338/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Stray "\303" and stray "\215" in program -- why?
提问by donkey
Instead of stray "\302" in program for which I found here, I got the error message:
我收到了错误消息,而不是我在此处找到的程序中的“\ 302” :
algo.c:118: error: stray ‘3' in program
algo.c:118: error: stray ‘5' in program
I could not seem to figure it out , what is this?
我好像没看明白,这是什么?
- EDIT
- 编辑
For future reference, stray '\XXX' means an incomprehensible character to the compiler. The way to fix is to find the '\XXX' character (which now I find out is not always this unicode, it can't be a wrong definition, such as '##' in '##define'), then delete or correct it. Good luck!
为了将来参考,杂散的 '\XXX' 意味着编译器无法理解的字符。修复的方法是找到'\XXX'字符(现在我发现它并不总是这个unicode,它不能是一个错误的定义,例如'##define'中的'##'),然后删除或纠正它。祝你好运!
回答by abligh
These are:
这些是:
00C3 LATIN CAPITAL LETTER A WITH TILDE
: 0041 0303
U+00C3, character ??, decimal 195, hex 0xC3, octal 3, binary 11000011
UTF-8: 0xc3 0x83
008D <control>
= REVERSE LINE FEED
U+008D, character ?, decimal 141, hex 0x8D, octal 5, binary 10001101
UTF-8: 0xc2 0x8d
I'm guessing those aren't there deliberately. Sometimes editing in a terminal can produce this if you start typing before the window has fully loaded and done its sttything. I often see this sort of thing in emacs.
我猜这些不是故意的。有时,如果您在窗口完全加载并完成其操作之前开始键入,则在终端中进行编辑会产生这种情况stty。我经常在emacs.
Solution: go to the appropriate lines and remove the characters. cat -teor lessare useful for identifying which characters are problematic.
解决方案:转到相应的行并删除字符。cat -te或less可用于识别哪些字符有问题。
回答by Coconop
As an additional answer, it happens to me a lot when I want to type characters that requires Alt Grcombination. Usually my fingers slipped and it results in hidden garbage character.
As said, better solution is to rewrite the spotted line.
作为一个额外的答案,当我想输入需要Alt Gr组合的字符时,它经常发生在我身上。通常我的手指会滑倒,这会导致隐藏的垃圾字符。如上所述,更好的解决方案是重写斑点线。
回答by Haselnussstrauch
Using non ascii charactersin code may cause this errors.
I had the sam issue using ??ü... in enum
在代码中使用非 ascii 字符可能会导致此错误。我在使用 ??ü... 时遇到了问题enum

