填空题 以下函数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______;


  • 1、
【正确答案】 1、p+n    
【答案解析】[解析] 指针变量移动的单位为存储单元.所以在函数fun中只需找到字符c在字符指针str所指字符串的位置n,返回该地址p+n即可。