#define _CRT_SECURE_NO_WARNINGS
#include "stdlib.h"
#include "stdio.h"
#include "string.h"
int main()
{
char buf1[100] = { 0 };
char buf2[100] = { 0 };
char *p1 = buf1;
char *p2 = buf2;
strcpy(p1, "abcdefg");
printf("p2,%d\n", p2);
printf("buf2,%d\n", buf2);
while (*p1 != '\0')
{
*p2++ = *p1++;
}
printf("p2,%d\n", p2);
printf("buf2,%d\n", buf2);
printf("p2,%d\n", *p2);
printf("buf2,%d\n", *buf2);
system("pause");
有这样代码,为什么运行出来的结果是这样 p2和buf2地址会差7?