c语言小白求大神帮忙详细解释一下下面的程序!

是判断输入的字符串中共有多少注释的程序。如果出现了/*,那么到*/出现,之间的内容算作输入字符串的一个注释。朋友做出来了给我看但是我看不太懂各行都是什么意思。求哪位大神帮忙讲解一下。程序如下:
# include<stdio.h>

# include<string.h>

# include<stdlib.h>

static int kazu = 0;

int comment2(char str[],int j){

if(str[j] == '/'){

kazu++;

return j;

}

return 0;

}

int comment(char str[],int j){

int i;

if(str[++j] == '/')return j;

if(str[j] == '*'){

for(j=j+1; j<strlen(str); j++){

if(str[j] == '*'){

i = comment2(str, j+1);

if(i){

return i;

}

}else{

continue;

}

}

}

return j;

}

int main(void){

char str [5000];

char s;

int i = 0;

while(scanf("%c",&s) == 1){

str[i] = s;

i++;

}

str[i] = '\0';

for(i=0;i<strlen(str);i++){

if(str[i]=='/'){

i=comment(str,i)-1;

}

}

printf("%d\n",kazu);

return 0;

}

int comment2(char str[],int j){当读到'/'返回保存他的位置
int comment(char str[],int j){如果下一个是“/‘直接返回,如果下一个是'*'继续前进追问

“int comment(char str[],int j)”是什么意思?

“int comment(char str[],int j)”是什么意思?

追答

头文件下面的吗。函数声明

追问

不好意思哦,c语言学的比较浅,可以说明一下int comment(char str[],int j)中括号里的内容对comment赋值有什么作用吗?

追答

传递参数呀,

追问

if(str[j] == '*'){for(j=j+1; j<strlen(str); j++){ if(str[j] == '*'){i = comment2(str, j+1); if(i){return i;}else{continue;}以及for(i=0;i<strlen(str);i++){ if(str[i]=='/'){i=comment(str,i)-1;
是什么意思?

追答

如果是*直到找到/返回/的序号,如果返回的序号不等于0,直接返回否则继续找,
下面的for循环找注释开始的/

温馨提示:答案为网友推荐,仅供参考