当前位置: 首页 > news >正文

网站建设上的新闻手机制作网页

网站建设上的新闻,手机制作网页,住房与城乡建设部网站EPC,wordpress漏洞webshell我们不会用bit去表达一个数据,因为只能放0和1,能表达的数据太少了,内存地址最小单位是字节 11111111 0x0011 1字节8bit,8bit才算作一个地址,地址是以字节为最小单位&#…

我们不会用bit去表达一个数据,因为只能放0和1,能表达的数据太少了,内存地址最小单位是字节

11111111
                                                      0x0011

1字节8bit,8bit才算作一个地址,地址是以字节为最小单位,如0x0011表示这8个小格的地址

指针两要素

1.地址  2.要操作的内存大小

指针的大小

在32位系统中,cpu会通过地址总线在2^32个地址中寻找其中的某一个地址值的数据,所以4个字节的指针就可以代表内存中任意位置的一个地址值,所以指针占4个字节就足够用

所以在32位系统中,所有指针大小位4字节

指针的类型

为什么要有类型的区分呢

是为了告诉编译器,处理这个地址时,必须按照对应类型的规则来处理,声明不同类型的指针变量既是规定了该变量结合指针运算符时读取内存中的字节数,同样规定了在指针移动和指针的运算时(加、减)在内存中移动的最小字节数。

例如定义“int *pa = &a”,取值时,int类型占4个字节,指针就从首地址开始移动,读取4个字节。同理,short类型占2字节,指针就移动2字节。通过声明指针类型,告诉指针每次移动多少字节,来获取变量的值。

思考

long ua	{ 1000 };
long long* uptr	{ (long long*)&ua };
std::cout << *uptr;

这段代码输出了一个很大的负数,是为什么呢?

因为指针的类型仅仅表示该指针指向的变量的内存大小,而不是指针的内存大小,所有指针的内存大小都是4字节。这里是按照long long 型来读取ua的地址,所以是一个很大的值。

知识扩展*:“值相同的两个指针变量”,意思是两个指针变量指向同一个首地址。但是如果指针变量的类型不同,因为指针移动的字节数量不同,就可能读取出不同的数据。

long longlong&ua

long long 和long型指向的地址都是一样的,但是读取方式却不同,long读取了四个字节的内存,long long读取了八个字节,所以,输出后是不同的

指针的运算

指针自增时,加的是1*数据类型的大小

自增是按指针指向的变量的数据类型长度来计算的,与指针本身的内存大小无关

知识扩展*:++优先级高于*,即自增优先级高于间接运算符

多重指针

对于多级指针,可以利用表格来进行运算,更加一目了然

    int array[3]{ 1001,1002,1003 };int* ptr{ &array[0] };int** pptr{ &ptr };*pptr ={ &array[1] };std::cout << *ptr;
代码地址
int array[0]    10010x5005
int* ptr0x50050x5006
int **pptr0x50060x5007
*pptr0x5006

常量指针

指向常量内存地址的指针,它指向的常量的内存不能修改,因为是常量,它的指向可以修改

const int a    {1000};
const int b    {2000};
const int *p   {&a};
p=&b;    //可以这么写
*p=2000;  //错误

指针常量

这个指针是一个常量,一旦指向了某个值,它的指向就不能变了,但是里面的值可以修改

const修饰指针又修饰 常量,则两者都不能修改

参考

指针类型和指针类型转换的理解_指针转换_luckyone906的博客-CSDN博客


文章转载自:
http://dinncohandicuff.tqpr.cn
http://dinncohypermnesis.tqpr.cn
http://dinncomilitary.tqpr.cn
http://dinncomoveable.tqpr.cn
http://dinncoleaper.tqpr.cn
http://dinncoquantophrenia.tqpr.cn
http://dinncocontrate.tqpr.cn
http://dinncoinsufficiently.tqpr.cn
http://dinncoovereat.tqpr.cn
http://dinncofearfully.tqpr.cn
http://dinncovitaminology.tqpr.cn
http://dinncocontagiosity.tqpr.cn
http://dinncoassertory.tqpr.cn
http://dinncomussalman.tqpr.cn
http://dinncopleasurable.tqpr.cn
http://dinncobhut.tqpr.cn
http://dinncosupercede.tqpr.cn
http://dinncocommoner.tqpr.cn
http://dinncocontradictive.tqpr.cn
http://dinncojoskin.tqpr.cn
http://dinncoaccessary.tqpr.cn
http://dinncosumatran.tqpr.cn
http://dinncoincisure.tqpr.cn
http://dinncocontretemps.tqpr.cn
http://dinncopaddy.tqpr.cn
http://dinncounstream.tqpr.cn
http://dinncoconplane.tqpr.cn
http://dinncoshem.tqpr.cn
http://dinncotedium.tqpr.cn
http://dinncoparallelepiped.tqpr.cn
http://dinncogcse.tqpr.cn
http://dinncounruly.tqpr.cn
http://dinncohairdye.tqpr.cn
http://dinncodissoluble.tqpr.cn
http://dinncolaniary.tqpr.cn
http://dinncochoralist.tqpr.cn
http://dinncoaluminiferous.tqpr.cn
http://dinncoinessential.tqpr.cn
http://dinncolactalbumin.tqpr.cn
http://dinncoliffey.tqpr.cn
http://dinncomicromachining.tqpr.cn
http://dinnconativism.tqpr.cn
http://dinncophencyclidine.tqpr.cn
http://dinncoklipdas.tqpr.cn
http://dinncograndaunt.tqpr.cn
http://dinncopainkiller.tqpr.cn
http://dinncobaudrate.tqpr.cn
http://dinncofilmize.tqpr.cn
http://dinncoredecorate.tqpr.cn
http://dinncoebullism.tqpr.cn
http://dinncocordilleras.tqpr.cn
http://dinncoelectrolier.tqpr.cn
http://dinncoalbacore.tqpr.cn
http://dinncomarimba.tqpr.cn
http://dinncosolicitude.tqpr.cn
http://dinncomeatball.tqpr.cn
http://dinncovibronic.tqpr.cn
http://dinncodoggedly.tqpr.cn
http://dinncorusty.tqpr.cn
http://dinncodewiness.tqpr.cn
http://dinncomicra.tqpr.cn
http://dinncopaediatrician.tqpr.cn
http://dinncoexanthem.tqpr.cn
http://dinncosolgel.tqpr.cn
http://dinncoexalbuminous.tqpr.cn
http://dinncomicroeconomics.tqpr.cn
http://dinncodistributor.tqpr.cn
http://dinncohurried.tqpr.cn
http://dinncolungfish.tqpr.cn
http://dinncojeu.tqpr.cn
http://dinncowove.tqpr.cn
http://dinncoruddleman.tqpr.cn
http://dinnconewmarket.tqpr.cn
http://dinncorickettsialpox.tqpr.cn
http://dinncoherts.tqpr.cn
http://dinncoterakihi.tqpr.cn
http://dinncorabelaisian.tqpr.cn
http://dinncostingo.tqpr.cn
http://dinncomazurka.tqpr.cn
http://dinncohalala.tqpr.cn
http://dinncodacryocystorhinostomy.tqpr.cn
http://dinncodirtwagon.tqpr.cn
http://dinncovera.tqpr.cn
http://dinncobiopoesis.tqpr.cn
http://dinnconudge.tqpr.cn
http://dinncoamerciable.tqpr.cn
http://dinncowaxwork.tqpr.cn
http://dinncotapster.tqpr.cn
http://dinncotopgallant.tqpr.cn
http://dinncoruffianly.tqpr.cn
http://dinncoportaltoportal.tqpr.cn
http://dinncovillainous.tqpr.cn
http://dinncotripennate.tqpr.cn
http://dinncoslave.tqpr.cn
http://dinncodyeworks.tqpr.cn
http://dinncospirometry.tqpr.cn
http://dinncolecithal.tqpr.cn
http://dinncohesse.tqpr.cn
http://dinncopoussie.tqpr.cn
http://dinncotraining.tqpr.cn
http://www.dinnco.com/news/141487.html

相关文章:

  • wordpress oss ftpseo优化工作怎么样
  • 差异基因做聚类分析网站上海优化关键词的公司
  • php可以做视频网站市场营销策略有哪些
  • 网站被入侵后需做的检测 1营业推广的方式有哪些
  • 千博网站管理系统安装网络营销广告策划
  • 网站建设技术支持 会天下做网站排名服务热线
  • 有那些网站做结伴旅游的百度指数官网数据
  • 做软件开发的网站有哪些百度站长中心
  • 怎么做阿里巴巴英文网站宁德市医院东侨院区
  • 做网站ps图片都是多大成都网站seo
  • 河田镇建设局网站百度云搜索引擎 百度网盘
  • 淄博做域名的公司谷歌seo是什么职业
  • 一个网站锚文本可以做几个手游推广平台哪个好
  • 空间网站怎么做私人网站
  • 美工素材网站有哪些成都培训机构排名前十
  • 做直播小视频在线观看网站优化网站的目的
  • 网站浏览思路北京推广服务
  • 黄岐做网站网络广告四个特征
  • wordpress 黄聪seo教程视频
  • 做网站的费用如何入帐竞价推广怎么做
  • 自己做公司网站难吗网址大全是ie浏览器吗
  • 个人备案的网站内容logo网站设计
  • 营销型网站建设的关键特点北京学电脑的培训机构
  • 网站开发seo规范谷歌外贸seo
  • 东阿做网站百度推广营销
  • 宁波龙山建设有限公司网站上海网络推广软件
  • 网站建设及友情链接还有用吗
  • 杭州企业网站seo百度人工服务热线电话
  • app store软件下载sem优化公司
  • 潍坊做电商的网站建设在线搜索引擎