C++:数组和指针占用的字节数sizeof

版权声明:本文为博主原创文章,转载请注明出处,谢谢。 https://blog.csdn.net/wfei101/article/details/80687395
int main()
{
	int a[6] = { 1, 1, 2, 3, 5 };
	int *p = a;


	printf("size =%d,%d\n", sizeof(a),*a);
	printf("size =%d\n", sizeof(*(&a+1)));
	printf("size =%d\n", sizeof(*(&a)));
	printf("size =%d\n", sizeof(&a+1));

	printf("size =%d\n", sizeof(p));
	printf("size =%d\n", sizeof(p+1));
	//printf("size =%d,%d\n", sizeof(&p + 1), *(&p + 1));
	printf("size =%d,%d\n", sizeof(&p), *&p);
}

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页