0
点赞
收藏
分享

微信扫一扫

关于指针p++

云竹文斋 2022-03-10 阅读 60
#include<bits/stdc++.h>
using namespace std;
int main(){
	unsigned long long a[]={(11ull)<<32|1,(12ull<<32)|2,3};
	unsigned int*p=(unsigned int*)a;
	p++;
	cout<<*p<<endl;
	cout<<p<<' '<<a+1<<endl; 
	return 0;
}

Output:

11
0x73fe04 0x73fe08
 

第一行输出

说明 底层的存储是从左往右由低位向高位,不管是日常生活中的运算还是位运算中高位都是在左

第二行输出

说明 指针的移动距离是基于其所指存储类型的大小

举报

相关推荐

0 条评论