二办理复学流程.ppt

二办理复学流程.ppt

ID:51212786

大小:259.50 KB

页数:34页

时间:2020-03-20

二办理复学流程.ppt_第1页
二办理复学流程.ppt_第2页
二办理复学流程.ppt_第3页
二办理复学流程.ppt_第4页
二办理复学流程.ppt_第5页
资源描述:

《二办理复学流程.ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、Chapter7-PointersOutline7.1Introduction7.2PointerVariableDeclarationsandInitialization7.3PointerOperators7.4CallingFunctionsbyReference7.5UsingtheconstQualifierwithPointers7.6BubbleSortUsingCallbyReference7.7PointerExpressionsandPointerArithmetic7.8TheRelationshipbetweenPointersandArrays7

2、.9ArraysofPointers7.10CaseStudy:ACardShufflingandDealingSimulation7.11PointerstoFunctions7.1IntroductionPointersPowerful,butdifficulttomasterSimulatecall-by-referenceCloserelationshipwitharraysandstrings7.2PointerVariableDeclarationsandInitializationPointervariablesContainmemoryaddressesa

3、stheirvaluesNormalvariablescontainaspecificvalue(directreference)Pointerscontainaddressofavariablethathasaspecificvalue(indirectreference)Indirection–referencingapointervaluecount7count7countPtr7.2PointerVariableDeclarationsandInitializationPointerdeclarations*usedwithpointervariablesint*

4、myPtr;Declaresapointertoanint(pointeroftypeint*)Multiplepointersrequireusinga*beforeeachvariabledeclarationint*myPtr1,*myPtr2;CandeclarepointerstoanydatatypeInitializepointersto0,NULL,oranaddress0orNULL–pointstonothing(NULLpreferred)7.3PointerOperators&(addressoperator)Returnsaddressofope

5、randinty=5;int*yPtr;yPtr=&y;//yPtrgetsaddressofyyPtr“pointsto”yyPtry5yptr500000600000y6000005Addressofyisvalueofyptr7.3PointerOperators*(indirection/dereferencingoperator)Returnsasynonym/aliasofwhatitsoperandpointsto*yptrreturnsy(becauseyptrpointstoy)*canbeusedforassignmentReturnsaliastoa

6、nobject*yptr=7;//changesyto7Dereferencedpointer(operandof*)mustbeanlvalue(noconstants)*and&areinversesTheycanceleachotherout1.Declarevariables2Initializevariables3.PrintProgramOutput1/*Fig.7.4:fig07_04.c2Usingthe&and*operators*/3#include45intmain()6{7inta;/*aisaninteger*/8int*aPt

7、r;/*aPtrisapointertoaninteger*/910a=7;11aPtr=&a;/*aPtrsettoaddressofa*/1213printf("Theaddressofais%p"14"ThevalueofaPtris%p",&a,aPtr);1516printf("Thevalueofais%d"17"Thevalueof*aPtris%d",a,*aPtr);1819printf("Showingthat*and&areinversesof"20"eachother.&*a

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

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

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