mystrlen函数的功能是计算str所指字符串的长度,并作为函数值返回。请填空。
int mystrlen(char *str)
{ int i;
for(i=0;【17】!= ′\0′;i++);
return(i);
}
第1题:
以下函数fun的功能是返回str所指字符串中以形参c中字符开头的后续字符串的首地址,例如,str所指字符串为Hello!,c中的字符为e,则函数返回字符串ello!的首地址。若str所指字符串为空或不包含c中的字符,则函数返回NULL,请填空。char *fun(char *str,char c){ int n=0; char *p=str; if(p!=NULL) while(p[n]!=c&&p[n]!=’\0’) n++; if(p[n]==’\0’) return NULL; return();}
第2题:
下列给定程序中,函数fun的功能是:求ss所指字符串数组中长度最短的字符串所在的行下标,作为函数值返回,并把其串长放在形参n所指的变量中。ss所指字符串数组中共有M个字符串,且串长小于N。请在程序的下划线处填入正确的内容并将下划线删除,使程序得出正确的结果。
第3题:
函数MyStrlen的功能是求pa标识的字符串长度,则划线处需要填写_______ int MyStrlen(char *pa){ int count=0; while(*pa != '0'){ ______++; ______++; } return ________; }
A.pa count count
B.count pa count
C.count pa pa
D.pa count pa
第4题:
mystrlen函数的功能是计算str所指字符串的长度,并作为函数值返回,请填空。int mystrlen(char *str) { int i; for(i=0;;i++); return(i); }
第5题:
函数strcmp( )的功能是对两个字符串进行比较,当s所指字符串和t所指字符串相等时,返回值为0;
当s所指字符串大于t所指字符串时,返回值大于0;当s所指字符串小于t所指字符串时,返回值小于
0(功能等同于库函数strcmp( ) ),请填空。
include <stdio.h>
int strcmp ( chat * s, char * t)
{ while( * s && * t && * s=【 】
{ s++;t++; }
return 【 】;
}