#include <stdio.h>
#include <stdlib.h>
int str(char *p,char *s){
while(*p!='\0'&&*s!='\0'){
if(*p>=*s){
return 1;
}else{
return 0;
}
p++;
s++;
}
}
void sub(char *p,char *s){
int i=0;
if((str(p,s)==1)){
for(i=0;i<5;i++){
*(s+i) = *(p+i);
}
*(s+5) = 0;
}
}
int main()
{
char s[21],*p="hello";
gets(s);
sub(p,s); //缺少参数
printf("%s\n",s);
return 0;
}
Click here to view the copyright notice of this site(点击此处查看本站版权声明)
必须 注册 为本站用户, 登录 后才可以发表评论!