xml分析错误:注释未终止
Comments are used to write logic explain or anything that you do not want to compile. In C language there are two types of comments 1) Single line comment and 2) Multi-line comment.
注释用于编写逻辑解释或您不想编译的任何内容。 在C语言中,注释有两种类型:1)单行注释和2)多行注释。
Read: Comments in C language
阅读: 用C语言编写的注释
Unterminated comment error occurred when we do not terminate the comment with a valid set of characters.
当我们不使用有效的字符集终止注释时,发生了未终止的注释错误。
Single line comment does not need to terminate, and it starts by a double slash (//), but, multiple line comment needs to be terminated by */ (asterisk and slash).
单行注释不需要终止,它以双斜杠( // )开头,但是多行注释需要以* / (星号和斜杠)终止。
Consider the program:
考虑该程序:
#include <stdio.h>
int main(void) {
/*printf is used to print a message \*
printf("Hello world");
return 0;
}
Output
输出量
prog.c: In function ‘main’:
prog.c:5:5: error: unterminated comment
/*printf is used to print a message \*
^
prog.c:3:1: error: expected declaration or statement at end of input
int main(void) {
^~~
如何修复C中的未终止注释错误 (How to fix Unterminated comment error in C)
Note that, multiple line comment are placed between /* and */, terminate the comment properly with valid characters.
请注意,在/ *和* /之间放置多行注释,并使用有效字符正确终止注释。
Correct code
正确的代码
#include <stdio.h>
int main(void) {
/*printf is used to print a message*/
printf("Hello world");
return 0;
}
Output
输出量
Hello world
翻译自: https://www.includehelp.com/c-programs/unterminated-comment-error-in-c.aspx
xml分析错误:注释未终止