#include
<
stdio.h
>
#include < string .h >
int main(){
char p[] = " iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii " ;
char flower1[ 5 ];
char s1[] = " lixiangfu " ;
printf( " p:%p,flower1:%p,s1:%p " ,p,flower1,s1);
char addon[] = " s smell like old shoes. " ;
gets(flower1);
strcat(flower1,addon);
puts(flower1);
puts(s1);
puts(p);
getchar();
return 0 ;
}
#include < string .h >
int main(){
char p[] = " iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii " ;
char flower1[ 5 ];
char s1[] = " lixiangfu " ;
printf( " p:%p,flower1:%p,s1:%p " ,p,flower1,s1);
char addon[] = " s smell like old shoes. " ;
gets(flower1);
strcat(flower1,addon);
puts(flower1);
puts(s1);
puts(p);
getchar();
return 0 ;
}
数组p变成了"ell like shoes."
就是因为strcat中flower1漫溢的数据