二维数组笔记(two dimensional array notes )

二维数组笔记(two dimensional array notes )

ID:14863373

大小:19.43 KB

页数:14页

时间:2018-07-30

二维数组笔记(two dimensional array notes )_第1页
二维数组笔记(two dimensional array notes )_第2页
二维数组笔记(two dimensional array notes )_第3页
二维数组笔记(two dimensional array notes )_第4页
二维数组笔记(two dimensional array notes )_第5页
资源描述:

《二维数组笔记(two dimensional array notes )》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、二维数组笔记03(Twodimensionalarraynotes03)Twodimensionalarray:Isaone-dimensionalarrayinwhicheachelementisaone-dimensionalarrayThedefinitionformatoftwodimensionalarray:Thattypeofarrayname[rowcolumnindex];Inta[2][3];1)lookattheentiretwo-dimensionalarray:A[i]<=>*(a+i)A[0]*(a+0)Inta[N][M];&a[i][j]C

2、onsidertheaddressofeachelementfromthepointofviewofthearraynameofatwo-dimensionalarray:1)&a[i][j]2)a[0]+i*M+j3)&a[0][0]+i*M+j4)a[i]+j5)*(a+i)+j6)&*(a+i)[j]1)theangleofthefirstaddress:A)thefirstaddressaoftheentiretwo-dimensionalarrayB)thefirstaddressofatwo-dimensionalarrayisalsothefirstaddr

3、essa[0]ofthefirstelementC)canbetheaddress&a[0][0]ofthefirstelementinthefirstelement2)considertheaddressofanyelementonthepreviousbasisA)taketheheadoftheentiretwo-dimensionalarrayasthereferencepoint2)a[0]+i*M+j3)&a[0][0]+i*M+jB)takethefirstaddressofeachelementofadimensionarrayasareferencepo

4、int4)a[i]+j5)*(a+i)+jC)taketheaddressdirectlytoeachspecificelement1)&a[i][j]6)&*(a+i)[j]Waysofreferencingelements:1)*(&a[i][j])<=>a[i][j]2)*(a[0]+i*M+j)3)*(&a[0][0]+i*M+j)4)*(a[i]+j)5)*(*(a+i)+j)6)*(a+i)[j]2)analyzetheaddressoftwodimensionalarrayfromthepointofviewofpointerarray:Pointerarr

5、ay:anarraycontainingmultipleelements,eachofwhichisapointertypeArraypointer:pointer,justapointer,thepointerpointstothespecifiedarrayInta[3][3],*p1,*p2,*p3;P1=a;//errorcannotbeatwo-dimensionalarraynameassignedtoanordinarypointerThetwocontentbasetypesareinconsistentP1=a[0];//legalP2=a[1];P3=

6、a[2];Int*p[3];*[]andallbelongtotheoperator,computingtheprioritylevelisatthesamelevel,combinedwiththerightcombinationDefininganarrayofpointers:Typedescription*arrayname[constantexpression]Adefinitionofmultiplepointerelements,eachelementbelongstotheordinarypointerInta[N][M],*p[N];Inta[3][3]

7、,*p[3];P[0]=a[0];P[1]=a[1];P[2]=a[2];For(i=0;i<3;i++)P[i]=a[i];Leteachpointerofthepointerarraypointtoeachrowofthetwo-dimensionalarray,respectively1)usethepointerarraytorepresenttheaddressofthetwo-dimensionalarrayelement:Theoreticalbasis:Pointertoonedimensionalarray,

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。