Title | References in C++dsfndfnrtnr hner n t 5h r tbr tbtd nrgev g n br brvw c rt ebvebnrsge vh3gbrtfb r brbdfbd b snrbfgbr gthdf 3 l;34pgbbmej nevnwkfnp jegp jojoi3fvopjfqiff c ucuevi vucbiv ieih icihci |
---|---|
Author | rohan sharma |
Course | Clinical Apprenticeship in Communication Disorders |
Institution | University of Missouri |
Pages | 2 |
File Size | 76.1 KB |
File Type | |
Total Downloads | 8 |
Total Views | 128 |
dsfndfnrtnr hner n t 5h r tbr tbtd nrgev g n br brvw c rt ebvebnrsge vh3gbrtfb r brbdfbd b snrbfgbr gthdf 3 l;34pgbbmej nevnwkfnp jegp jojoi3fvopjfqiff c ucuevi vucbiv ieih icihciuh 9uh ohggjuefoe 9u jbvje hg9iegije 9i egi irhouevjibe;o higheohg uiehouhgopijg iurohiegniuehojw fniue nkhiogije 9ev...
ReferencesinC++
ReferenceVariable Areferencevariableisanalias,thatis,anothernameforan alreadyexistingvariable/memoryinstance. Onceareferenceisinitializedwithavariable,eitherthevariable nameorthereferencenamemaybeusedtorefertothevariable. Thereferencevariableoncedefinedtorefertoavariablecan’t bechangedtopointtoothervariable.
DefiningReferenceVariable Referencevariablesaredefinedbyusing&symbolinthedefinition. Sincetheydonothaveanystorageoftheirownandarejust anothernameforthe existingstorage,theyneedtoinitializedbeforeusingthem. Fore.g. intx;
int&y=x.
TheexisitingmemoryXwillnowalsohaveanothernameY.
ReferenceVariableVSPointerVariable YoucannothaveNULLreferences.Youmustalwaysbeableto assumethatareferenceisconnectedtoalegitimatepieceof storage. Onceareferenceisinitializedtoanobject,itcannotbechangedto refertoanotherobject.Pointerscanbepointedtoanotherobjectat anytime. Areferencemustbeinitializedwhenitiscreated.Pointerscanbe initializedatanytime....