代码中的标记数

Number of tokens in code

 void main()
 {
    i/* nt */a=10;
    return;
 }

上面代码中的令牌数:?

我通过删除注释而不考虑白色计算为 13 space

我们是否将 'i' 和 'a' 视为删除评论后的单个标记? 非常感谢

是两个代币。注释被替换为单个 space,因此删除注释后相当于:

i a=10;

space 分隔标记。

来自Wikipedia article on the C Preprocessor

  1. Tokenization: The preprocessor breaks the result into preprocessing tokens and whitespace. It replaces comments with whitespace.