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分析錯誤:注釋未終止