不是說內存空間不能重疊嗎 為什么可以運行成功了
#include?<stdio.h> #include?<string.h> int?main() { ????char?s1[100]=""; ????char?s2[32]="18歲少年想當軟件工程師"; ????char?s3[]="慕課網"; ???? ???? ????printf("%s\n",strcat(s2,s3)); ????return?0;???? }
#include?<stdio.h> #include?<string.h> int?main() { ????char?s1[100]=""; ????char?s2[32]="18歲少年想當軟件工程師"; ????char?s3[]="慕課網"; ???? ???? ????printf("%s\n",strcat(s2,s3)); ????return?0;???? }
2017-11-30
舉報
2018-01-18
你可以先用strlen看一下s2和s3的長度,看看兩個加起來是不是超過了內存
2017-12-02
的確不能重疊,但是它是直接加在s2后面的。