c语言删掉注释,c语言删除注释

更新时间:2023-05-31 08:19:20 阅读: 评论:0

c语⾔删掉注释,c语⾔删除注释/*
* delete comment in C
*/
#include
#define normal 0
void rcomment(int c);
void in_comment(void);
void echo_quote(int c);
main()拓展训练项目
{
int c;线下推广
while ((c = getchar()) != EOF)
rcomment(c);
return 0;
}
void rcomment(int c)
{
int d;
敬请光临if (c == ‘/‘)
if ((d = getchar()) == ‘*‘)
in_comment();
我也一样el if (d == ‘/‘) {
putchar(c);
rcomment(d);
} el {
putchar(c);
putchar(d);
} el if (c == ‘\‘‘ || c == ‘"‘)
echo_quote(c);
el
篇章结构putchar(c);
}
void in_comment(void)
{
int c,d;
c=getchar();
d=getchar();
while(c!=‘*‘ || d!=‘/‘){
c=d;
d=getchar();
}
}
void echo_quote(int c)
{
int d;
四级评分标准putchar(c);
while((d=getchar())!=c){
putchar(d);
if(d==‘\\‘)
putchar(getchar());
}
putchar(d);冰鲜鱼
}
书中答案rcomment函数中的
el if (d == ‘/‘) {
连忙的近义词
putchar(c);
rcomment(d);
} 这个语句看了好久没没明⽩什么意思,测试程序的话,不处理‘//‘注释,只删除/*  */之间的,不敢确定是不是答案有问题。估计这是原本应该删除//到换⾏之间的注释的,若是这样,这个语句应改为:
el if (d == ‘/‘) {
while(getchar()!=‘\n‘);
}

本文发布于:2023-05-31 08:19:20,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/89/955549.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:答案   删除   估计
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图