xml分析错误:注释未终止_错误:C中的未终止注释(无效的注释块) 常见的C程序错误...

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分析错误:注释未终止

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值