What can create a lexical error in C?

后端 未结 6 755
轻奢々
轻奢々 2021-01-02 17:37

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

6条回答
  •  离开以前
    2021-01-02 18:08

    Here are some:

     "abc
    

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

     0x
    

    I assume that using bad escapes in strings is illegal:

      "ab\qcd"
    

    Probably trouble with floating point exponents

     1e+%
    

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

    #if x   %
    

提交回复
热议问题