什么会在 C 中造成词法错误? [英] What can create a lexical error in C?

查看:17
本文介绍了什么会在 C 中造成词法错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了不关闭注释/*...,什么构成了 C 中的词法错误?

Besides not closing a comment /*..., what constitutes a lexical error in C?

推荐答案

这里有一些:

 "abc<EOF>

其中 EOF 是文件的结尾.其实很多词位中间的EOF应该会产生错误:

where EOF is the end of the file. In fact, EOF in the middle of many lexemes should produce errors:

 0x<EOF>

我认为在字符串中使用错误转义是非法的:

I assume that using bad escapes in strings is illegal:

  "abqcd"

可能是浮点指数的问题

 1e+%

可以说,您不应该在预处理器指令的末尾添加内容:

Arguably, you shouldn't have stuff at the end of a preprocessor directive:

#if x   %

这篇关于什么会在 C 中造成词法错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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