C | 发现个有趣的小东西

#include <stdio.h>

int main(){
	int a = 1;
	int b = a;
	int c = a;
	printf("%d %d %d",&a, &b, &c);
	return 0;
}

把a的值赋给b和c,那么a,b和c应该指向同一个内存地址,但是结果不是这样的:

6487708 6487704 6487700
--------------------------------
Process exited after 0.165 seconds with return value 0

为什么呢?

发布了38 篇原创文章 · 获赞 5 · 访问量 6555

猜你喜欢

转载自blog.csdn.net/shaotianyang12/article/details/103543019