我想得到helloello这个结果,为什么会运行不出来呢?
#include<stdio.h>
#include<string.h>
int main()
{
char str[] = "hello";
char* pstr = str;
char* p = pstr + 1;
strcat(pstr,p);
puts(str);
return 0;
}
我想得到helloello这个结果,为什么会运行不出来呢?
#include<stdio.h>
#include<string.h>
int main()
{
char str[] = "hello";
char* pstr = str;
char* p = pstr + 1;
strcat(pstr,p);
puts(str);
return 0;
}
pstr 与 P内存重叠
参考 https://zhidao.baidu.com/question/1695485611736752548.html