3:usingnamespacestd。4:intglobalJ=999。5: 6://返回值7:intte"> 3:usingnamespacestd。4:intglobalJ=999。5: 6://返回值7:intte" />
欢迎来到天天文库
浏览记录
ID:52707591
大小:24.50 KB
页数:4页
时间:2020-03-29
《对引用和指针使用以及函数返回引用和指针类型的理解.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、引用的符号是&,指针的符号是*先来看看一段测试代码,1:#include"stdafx.h"2:#include3:usingnamespacestd。4:intglobalJ=999。5: 6://返回值7:inttest1(>8:{9:intj=1。10:cout<<"intest1(>,[returnvalue]thevaraiblej'saddress:"<<&j<17:{18:intj=998。19:cout<<"intest2
2、(>,[usefieldvariableandreturnreference]thelocalvaraibleJ'saddress:"<<&j<,[usefieldvariableandreturnreference]thelocalvaraibleJ'svalue:"<27:{28:29:cout<<"intest3(>,[useglobalvariableandreturnrefe
3、rence]thevaraibleglobalJ'saddress:"<<&globalJ<4/437:{38:intj=998。39:cout<<"intest4(>,[usefieldvariableandreturnpointer]thelocalvaraibleJ'saddress:"<<&j<,[usefieldvariableandreturnpointer]theloca
4、lvaraibleJ'svalue:"<47:{48:cout<<"intest5(>[useglobalvariableandreturnpointer],thevaraibleglobalJ'saddress:"<<&globalJ<54:{55:printf("Hellofunctions!">。56:5
5、7:inttestresultvalue=0。58:testresultvalue=test1(>。59:cout<<"testResultValueaddress:"<<&testresultvalue<。65
6、:cout<<"testResultReferenceaddress:"<<&testResultReference<。70:cout<<"testResultReferenceaddress:"<<&testR
7、esultReference<
此文档下载收益归作者所有