注释占用多个行,但不能嵌套。
编译器忽略在注释的字符。
此示例是编译器接受的注释:
/* Comments can contain keywords such as for and while without generating errors. */
注释可以出现在行和代码语句相同:
printf( "Hello\n" ); /* Comments can go here */
可以选择在函数或具有描述性注释的程序模块块:
/* MATHERR.C illustrates writing an error routine * for math functions. */
因为注释不能包含嵌套的注释,此示例导致错误:
/* Comment out this routine for testing
/* Open file */
fh = _open( "myfile.c", _O_RDONLY );
.
.
.
*/
*/ 它尝试处理剩余的文本会产生错误。
预处理器指令引用。
Microsoft 专用
这些注释不能扩展到第二行。
// This is a valid comment
转义序列。)
// my comment \
i++;
i++; 语句批注。
使用 /Za 禁用这些扩展。
引:http://msdn.microsoft.com/zh-CN/library/vstudio/wfwda74e.aspx