SlideShare a Scribd company logo
1 of 26
Introduction ttoo PPrrooggrraammmmiinngg 
LLeeccttuurree 3300
In TTooddaayy’’ss LLeeccttuurree 
– References 
– DDiiffffeerreenncceess 
BBeettwweeeenn RReeffeerreenncceess 
aanndd PPooiinntteerrss
RReeffeerreennccee
&&
iinntt && ii ;; ‘‘ii’’ iiss aa rreeffeerreennccee ttoo aann iinntteeggeerr 
iinntt ** ii ;; ‘‘ii’’ iiss aa ppooiinntteerr ttoo aann iinntteeggeerr
iinntt ii ;; 
iinntt && jj == ii ;;
EExxaammppllee 
mmaaiinn ( ) 11 
{{ 
iinntt ii ;; 
iinntt && jj == ii ;; 
ii == 112233 ;; OOuuttppuutt 
ccoouutt <<<< ii <<<< eennddll ;; 112233 
ccoouutt <<<< jj <<<< eennddll ;; 112233 
ii++++ ;; 
ccoouutt <<<< ii <<<< eennddll ;; 112244 
ccoouutt <<<< jj ;; 112244 
}}
EExxaammppllee 22 
vvooiidd sswwaapp (( iinntt xx ,, iinntt 
yy )) 
{{ 
iinntt tteemmpp == xx ;; 
xx == yy ;; 
yy == tteemmpp ;; 
}}
EExxaammppllee 22 
mmaaiinn (( )) 
{{ 
iinntt xx ,, yy ;; 
xx == 1100 ;; 
yy == 2200 ;; 
sswwaapp (( xx ,, yy )) ;; 
ccoouutt <<<< xx <<<< yy ;; 
}}
EExxaammppllee 22 
mmaaiinn (( )) 
{{ 
iinntt xx ,, yy ;; 
xx == 1100 ;; yy == 2200 ;; 
sswwaapp (( && xx ,, && yy )) ;; 
ccoouutt <<<< xx <<<< yy ;; 
}}
swap (( iinntt ** ii ,, iinntt ** 
jj )) ;;
EExxaammppllee 22 
void swap ( iinntt ** ii ,, iinntt ** jj )) 
{{ 
iinntt ** tteemmpp == ii ;; 
** ii == ** jj ;; 
** jj == ** tteemmpp ;; 
}}
EExxaammppllee 33 
void swap ( iinntt && ii ,, iinntt && jj )) 
{{ 
iinntt tteemmpp == ii ;; 
ii == jj ;; 
jj == tteemmpp ;; 
}}
EExxaammppllee 33 
mmaaiinn (( )) 
{{ 
iinntt xx ,, yy ;; 
xx == 1100 ;; 
yy == 2200 ;; 
sswwaapp (( xx ,, yy )) ;; 
ccoouutt <<<< xx <<<< yy ;; 
}}
ccoonnsstt
EExxaammppllee 44 
ssttrruucctt bb 
{{ 
iinntt sseerrnnoo ;; 
cchhaarr tteexxtt [[ 11000000 ]] ;; //// AA lloott ooff cchhaarrss 
}} bb == {{ 112233,, "TThhiiss iiss aa BBIIGG ssttrruuccttuurree" }} ;; 
vvooiidd vvaallffuunncc (( bb )) ;; //// CCaallll bbyy vvaalluuee 
vvooiidd ppttrrffuunncc (( ** bb )) ;; //// CCaallll bbyy ppooiinntteerr 
vvooiidd rreeffffuunncc (( && bb )) ;; //// CCaallll bbyy rreeffeerreennccee
EExxaammppllee 44 
vvooiidd mmaaiinn (( )) 
{{ 
vvaallffuunncc (( bb )) ;; //// PPaassssiinngg tthhee vvaarriiaabbllee iittsseellff 
ppttrrffuunncc (( && bb )) ;; //// PPaassssiinngg tthhee aaddddrreessss ooff tthhee vvaarriiaabbllee 
rreeffffuunncc (( bb )) ;; //// PPaassssiinngg aa rreeffeerreennccee ttoo tthhee vvaarriiaabbllee 
}}
EExxaammppllee 44 
ssttrruucctt bb 
{{ 
iinntt sseerrnnoo ;; 
cchhaarr tteexxtt [[ 11000000 ]] ;; //// AA lloott ooff cchhaarrss 
}} bb == {{ 112233 ,, "TThhiiss iiss aa BBIIGG ssttrruuccttuurree" }} ;; 
vvooiidd vvaallffuunncc (( bb )) ;; //// CCaallll bbyy vvaalluuee 
vvooiidd ppttrrffuunncc (( ccoonnsstt ** bb )) ;; //// CCaallll bbyy ppooiinntteerr 
vvooiidd rreeffffuunncc (( ccoonnsstt && bb )) ;; //// CCaallll bbyy rreeffeerreennccee
Difference BBeettwweeeenn 
RReeffeerreenncceess aanndd 
PPooiinntteerrss
mmaaiinn (( )) 
{{ 
iinntt ii ;; 
iinntt && rreeffii == ii ;; 
ccoouutt <<<< ““TThhee aaddddrreessss ooff tthhee 
rreeffeerreennccee iiss ”” <<<< && 
rreeffii ;; 
ccoouutt <<<< && ii ;; 
}}
DDaanngglliinngg 
RReeffeerreenncc 
ee
References aass RReettuurrnn 
iinntt mmyynnuumm == 00 ;; ///V/V GGaalloolbbluuaall eevvaassrriiaabbllee 
iinntt && nnuumm (( )) 
{{ 
rreettuurrnn mmyynnuumm ;; 
}} 
vvooiidd mmaaiinn (( )) 
{{ 
iinntt ii ;; 
mmyynnuumm == 110000 ;; 
ii == nnuumm (( )) ;; 
nnuumm (( )) == 220000 ;; 
}}
iinntt && ii ;; 
ddoouubbllee && ff ;; 
cchhaarr && cc ;;
aa == bb == cc ;;
aa == bb ;;
cout << ““TThhee vvaalluueess ooff tthhee 
iinntteeggeerr iiss ””<<<< ii <<<< eennddll ;;

More Related Content

What's hot

CS201- Introduction to Programming- Lecture 21
CS201- Introduction to Programming- Lecture 21CS201- Introduction to Programming- Lecture 21
CS201- Introduction to Programming- Lecture 21Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 12
CS201- Introduction to Programming- Lecture 12CS201- Introduction to Programming- Lecture 12
CS201- Introduction to Programming- Lecture 12Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 29
CS201- Introduction to Programming- Lecture 29CS201- Introduction to Programming- Lecture 29
CS201- Introduction to Programming- Lecture 29Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 15
CS201- Introduction to Programming- Lecture 15CS201- Introduction to Programming- Lecture 15
CS201- Introduction to Programming- Lecture 15Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 09
CS201- Introduction to Programming- Lecture 09CS201- Introduction to Programming- Lecture 09
CS201- Introduction to Programming- Lecture 09Bilal Ahmed
 
Termoquímica - Setor Leste
Termoquímica - Setor LesteTermoquímica - Setor Leste
Termoquímica - Setor LesteMarianaMartinsR
 
Perangkat Keras Hardware
Perangkat Keras HardwarePerangkat Keras Hardware
Perangkat Keras HardwareJohan19931106
 
pengenalan perangkat keras komputer
pengenalan perangkat keras komputerpengenalan perangkat keras komputer
pengenalan perangkat keras komputerzee120196
 
Potential and kinetic energy
Potential and kinetic energyPotential and kinetic energy
Potential and kinetic energyYash Chopra
 
CS201- Introduction to Programming- Lecture 34
CS201- Introduction to Programming- Lecture 34CS201- Introduction to Programming- Lecture 34
CS201- Introduction to Programming- Lecture 34Bilal Ahmed
 
anatomy of the larynx
anatomy of the larynxanatomy of the larynx
anatomy of the larynxPave Medicine
 
CS201- Introduction to Programming- Lecture 36
CS201- Introduction to Programming- Lecture 36CS201- Introduction to Programming- Lecture 36
CS201- Introduction to Programming- Lecture 36Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 14
CS201- Introduction to Programming- Lecture 14CS201- Introduction to Programming- Lecture 14
CS201- Introduction to Programming- Lecture 14Bilal Ahmed
 
Government resources
Government resourcesGovernment resources
Government resourcesKatie Avery
 
Le Black's Law Dictionary, monument de la lexicographie juridique - ATA 2010
Le Black's Law Dictionary, monument de la lexicographie juridique - ATA 2010Le Black's Law Dictionary, monument de la lexicographie juridique - ATA 2010
Le Black's Law Dictionary, monument de la lexicographie juridique - ATA 2010Frédéric Houbert
 
CS201- Introduction to Programming- Lecture 25
CS201- Introduction to Programming- Lecture 25CS201- Introduction to Programming- Lecture 25
CS201- Introduction to Programming- Lecture 25Bilal Ahmed
 

What's hot (19)

CS201- Introduction to Programming- Lecture 21
CS201- Introduction to Programming- Lecture 21CS201- Introduction to Programming- Lecture 21
CS201- Introduction to Programming- Lecture 21
 
CS201- Introduction to Programming- Lecture 12
CS201- Introduction to Programming- Lecture 12CS201- Introduction to Programming- Lecture 12
CS201- Introduction to Programming- Lecture 12
 
La exploración del sistema solar
La exploración del sistema solarLa exploración del sistema solar
La exploración del sistema solar
 
CS201- Introduction to Programming- Lecture 29
CS201- Introduction to Programming- Lecture 29CS201- Introduction to Programming- Lecture 29
CS201- Introduction to Programming- Lecture 29
 
CS201- Introduction to Programming- Lecture 15
CS201- Introduction to Programming- Lecture 15CS201- Introduction to Programming- Lecture 15
CS201- Introduction to Programming- Lecture 15
 
CS201- Introduction to Programming- Lecture 09
CS201- Introduction to Programming- Lecture 09CS201- Introduction to Programming- Lecture 09
CS201- Introduction to Programming- Lecture 09
 
Termoquímica - Setor Leste
Termoquímica - Setor LesteTermoquímica - Setor Leste
Termoquímica - Setor Leste
 
Perangkat Keras Hardware
Perangkat Keras HardwarePerangkat Keras Hardware
Perangkat Keras Hardware
 
Perangkat keras komputer
Perangkat keras komputerPerangkat keras komputer
Perangkat keras komputer
 
Hardware
HardwareHardware
Hardware
 
pengenalan perangkat keras komputer
pengenalan perangkat keras komputerpengenalan perangkat keras komputer
pengenalan perangkat keras komputer
 
Potential and kinetic energy
Potential and kinetic energyPotential and kinetic energy
Potential and kinetic energy
 
CS201- Introduction to Programming- Lecture 34
CS201- Introduction to Programming- Lecture 34CS201- Introduction to Programming- Lecture 34
CS201- Introduction to Programming- Lecture 34
 
anatomy of the larynx
anatomy of the larynxanatomy of the larynx
anatomy of the larynx
 
CS201- Introduction to Programming- Lecture 36
CS201- Introduction to Programming- Lecture 36CS201- Introduction to Programming- Lecture 36
CS201- Introduction to Programming- Lecture 36
 
CS201- Introduction to Programming- Lecture 14
CS201- Introduction to Programming- Lecture 14CS201- Introduction to Programming- Lecture 14
CS201- Introduction to Programming- Lecture 14
 
Government resources
Government resourcesGovernment resources
Government resources
 
Le Black's Law Dictionary, monument de la lexicographie juridique - ATA 2010
Le Black's Law Dictionary, monument de la lexicographie juridique - ATA 2010Le Black's Law Dictionary, monument de la lexicographie juridique - ATA 2010
Le Black's Law Dictionary, monument de la lexicographie juridique - ATA 2010
 
CS201- Introduction to Programming- Lecture 25
CS201- Introduction to Programming- Lecture 25CS201- Introduction to Programming- Lecture 25
CS201- Introduction to Programming- Lecture 25
 

Viewers also liked

CS201- Introduction to Programming- Lecture 44
CS201- Introduction to Programming- Lecture 44CS201- Introduction to Programming- Lecture 44
CS201- Introduction to Programming- Lecture 44Bilal Ahmed
 
CS101- Introduction to Computing- Lecture 45
CS101- Introduction to Computing- Lecture 45CS101- Introduction to Computing- Lecture 45
CS101- Introduction to Computing- Lecture 45Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 42
CS201- Introduction to Programming- Lecture 42CS201- Introduction to Programming- Lecture 42
CS201- Introduction to Programming- Lecture 42Bilal Ahmed
 
ENG101- English Comprehension- Lecture 38
ENG101- English Comprehension- Lecture 38ENG101- English Comprehension- Lecture 38
ENG101- English Comprehension- Lecture 38Bilal Ahmed
 
CS101- Introduction to Computing- Lecture 25
CS101- Introduction to Computing- Lecture 25CS101- Introduction to Computing- Lecture 25
CS101- Introduction to Computing- Lecture 25Bilal Ahmed
 
MGT101 - Financial Accounting- Lecture 35
MGT101 - Financial Accounting- Lecture 35MGT101 - Financial Accounting- Lecture 35
MGT101 - Financial Accounting- Lecture 35Bilal Ahmed
 
MGT101 - Financial Accounting- Lecture 32
MGT101 - Financial Accounting- Lecture 32MGT101 - Financial Accounting- Lecture 32
MGT101 - Financial Accounting- Lecture 32Bilal Ahmed
 
MGT101 - Financial Accounting- Lecture 23
MGT101 - Financial Accounting- Lecture 23MGT101 - Financial Accounting- Lecture 23
MGT101 - Financial Accounting- Lecture 23Bilal Ahmed
 
CS101- Introduction to Computing- Lecture 36
CS101- Introduction to Computing- Lecture 36CS101- Introduction to Computing- Lecture 36
CS101- Introduction to Computing- Lecture 36Bilal Ahmed
 
ENG101- English Comprehension- Lecture 26
ENG101- English Comprehension- Lecture 26ENG101- English Comprehension- Lecture 26
ENG101- English Comprehension- Lecture 26Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 17
CS201- Introduction to Programming- Lecture 17CS201- Introduction to Programming- Lecture 17
CS201- Introduction to Programming- Lecture 17Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 41
CS201- Introduction to Programming- Lecture 41CS201- Introduction to Programming- Lecture 41
CS201- Introduction to Programming- Lecture 41Bilal Ahmed
 
CS101- Introduction to Computing- Lecture 28
CS101- Introduction to Computing- Lecture 28CS101- Introduction to Computing- Lecture 28
CS101- Introduction to Computing- Lecture 28Bilal Ahmed
 
Irr verbs21 2_sl
Irr verbs21 2_slIrr verbs21 2_sl
Irr verbs21 2_slKarim Babni
 
Designing for the Voter Experience: Learning from Voters
Designing for the Voter Experience: Learning from VotersDesigning for the Voter Experience: Learning from Voters
Designing for the Voter Experience: Learning from VotersCenter for Civic Design
 
Ensayo sobre la ceguera josé saramago
Ensayo sobre la ceguera josé saramagoEnsayo sobre la ceguera josé saramago
Ensayo sobre la ceguera josé saramagoCatalina Meneses
 

Viewers also liked (19)

CS201- Introduction to Programming- Lecture 44
CS201- Introduction to Programming- Lecture 44CS201- Introduction to Programming- Lecture 44
CS201- Introduction to Programming- Lecture 44
 
CS101- Introduction to Computing- Lecture 45
CS101- Introduction to Computing- Lecture 45CS101- Introduction to Computing- Lecture 45
CS101- Introduction to Computing- Lecture 45
 
CS201- Introduction to Programming- Lecture 42
CS201- Introduction to Programming- Lecture 42CS201- Introduction to Programming- Lecture 42
CS201- Introduction to Programming- Lecture 42
 
ENG101- English Comprehension- Lecture 38
ENG101- English Comprehension- Lecture 38ENG101- English Comprehension- Lecture 38
ENG101- English Comprehension- Lecture 38
 
CS101- Introduction to Computing- Lecture 25
CS101- Introduction to Computing- Lecture 25CS101- Introduction to Computing- Lecture 25
CS101- Introduction to Computing- Lecture 25
 
MGT101 - Financial Accounting- Lecture 35
MGT101 - Financial Accounting- Lecture 35MGT101 - Financial Accounting- Lecture 35
MGT101 - Financial Accounting- Lecture 35
 
MGT101 - Financial Accounting- Lecture 32
MGT101 - Financial Accounting- Lecture 32MGT101 - Financial Accounting- Lecture 32
MGT101 - Financial Accounting- Lecture 32
 
MGT101 - Financial Accounting- Lecture 23
MGT101 - Financial Accounting- Lecture 23MGT101 - Financial Accounting- Lecture 23
MGT101 - Financial Accounting- Lecture 23
 
CS101- Introduction to Computing- Lecture 36
CS101- Introduction to Computing- Lecture 36CS101- Introduction to Computing- Lecture 36
CS101- Introduction to Computing- Lecture 36
 
ENG101- English Comprehension- Lecture 26
ENG101- English Comprehension- Lecture 26ENG101- English Comprehension- Lecture 26
ENG101- English Comprehension- Lecture 26
 
CS201- Introduction to Programming- Lecture 17
CS201- Introduction to Programming- Lecture 17CS201- Introduction to Programming- Lecture 17
CS201- Introduction to Programming- Lecture 17
 
CS201- Introduction to Programming- Lecture 41
CS201- Introduction to Programming- Lecture 41CS201- Introduction to Programming- Lecture 41
CS201- Introduction to Programming- Lecture 41
 
CS101- Introduction to Computing- Lecture 28
CS101- Introduction to Computing- Lecture 28CS101- Introduction to Computing- Lecture 28
CS101- Introduction to Computing- Lecture 28
 
Making information easy for voters
Making information easy for votersMaking information easy for voters
Making information easy for voters
 
Lesson 1
Lesson 1 Lesson 1
Lesson 1
 
Irr verbs21 2_sl
Irr verbs21 2_slIrr verbs21 2_sl
Irr verbs21 2_sl
 
Designing for the Voter Experience: Learning from Voters
Designing for the Voter Experience: Learning from VotersDesigning for the Voter Experience: Learning from Voters
Designing for the Voter Experience: Learning from Voters
 
Ensayo sobre la ceguera josé saramago
Ensayo sobre la ceguera josé saramagoEnsayo sobre la ceguera josé saramago
Ensayo sobre la ceguera josé saramago
 
WhatsApp
WhatsApp WhatsApp
WhatsApp
 

Similar to CS201- Introduction to Programming- Lecture 30

CS201- Introduction to Programming- Lecture 28
CS201- Introduction to Programming- Lecture 28CS201- Introduction to Programming- Lecture 28
CS201- Introduction to Programming- Lecture 28Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 38
CS201- Introduction to Programming- Lecture 38CS201- Introduction to Programming- Lecture 38
CS201- Introduction to Programming- Lecture 38Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 20
CS201- Introduction to Programming- Lecture 20CS201- Introduction to Programming- Lecture 20
CS201- Introduction to Programming- Lecture 20Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 33
CS201- Introduction to Programming- Lecture 33CS201- Introduction to Programming- Lecture 33
CS201- Introduction to Programming- Lecture 33Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 23
CS201- Introduction to Programming- Lecture 23CS201- Introduction to Programming- Lecture 23
CS201- Introduction to Programming- Lecture 23Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 35
CS201- Introduction to Programming- Lecture 35CS201- Introduction to Programming- Lecture 35
CS201- Introduction to Programming- Lecture 35Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 24
CS201- Introduction to Programming- Lecture 24CS201- Introduction to Programming- Lecture 24
CS201- Introduction to Programming- Lecture 24Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 22
CS201- Introduction to Programming- Lecture 22CS201- Introduction to Programming- Lecture 22
CS201- Introduction to Programming- Lecture 22Bilal Ahmed
 
ADEWOYE OMONIYI ADEYEMI PR
ADEWOYE OMONIYI ADEYEMI PRADEWOYE OMONIYI ADEYEMI PR
ADEWOYE OMONIYI ADEYEMI PRAdewoye Omoniyi
 
CS201- Introduction to Programming- Lecture 13
CS201- Introduction to Programming- Lecture 13CS201- Introduction to Programming- Lecture 13
CS201- Introduction to Programming- Lecture 13Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 11
CS201- Introduction to Programming- Lecture 11CS201- Introduction to Programming- Lecture 11
CS201- Introduction to Programming- Lecture 11Bilal Ahmed
 
TOP Downloaded Papers (January)--International Journal of Computer Networks &...
TOP Downloaded Papers (January)--International Journal of Computer Networks &...TOP Downloaded Papers (January)--International Journal of Computer Networks &...
TOP Downloaded Papers (January)--International Journal of Computer Networks &...IJCNCJournal
 
Aula6 estresse térmico e zct
Aula6 estresse térmico e zctAula6 estresse térmico e zct
Aula6 estresse térmico e zctAirton Alencar
 
pertolongan cemas, anduh, pbsm, pengakap
pertolongan cemas, anduh, pbsm, pengakappertolongan cemas, anduh, pbsm, pengakap
pertolongan cemas, anduh, pbsm, pengakapKhairul Hanan
 
Osteo osteomalacia ricket2
Osteo osteomalacia ricket2Osteo osteomalacia ricket2
Osteo osteomalacia ricket2padli ahmad
 
CS201- Introduction to Programming- Lecture 04
CS201- Introduction to Programming- Lecture 04CS201- Introduction to Programming- Lecture 04
CS201- Introduction to Programming- Lecture 04Bilal Ahmed
 
Contrarrazoes ro vinculo empregaticio reclamada ilovepdf-compressed
Contrarrazoes ro vinculo empregaticio reclamada ilovepdf-compressedContrarrazoes ro vinculo empregaticio reclamada ilovepdf-compressed
Contrarrazoes ro vinculo empregaticio reclamada ilovepdf-compressedLeve Desejo
 

Similar to CS201- Introduction to Programming- Lecture 30 (20)

CS201- Introduction to Programming- Lecture 28
CS201- Introduction to Programming- Lecture 28CS201- Introduction to Programming- Lecture 28
CS201- Introduction to Programming- Lecture 28
 
CS201- Introduction to Programming- Lecture 38
CS201- Introduction to Programming- Lecture 38CS201- Introduction to Programming- Lecture 38
CS201- Introduction to Programming- Lecture 38
 
CS201- Introduction to Programming- Lecture 20
CS201- Introduction to Programming- Lecture 20CS201- Introduction to Programming- Lecture 20
CS201- Introduction to Programming- Lecture 20
 
CS201- Introduction to Programming- Lecture 33
CS201- Introduction to Programming- Lecture 33CS201- Introduction to Programming- Lecture 33
CS201- Introduction to Programming- Lecture 33
 
CS201- Introduction to Programming- Lecture 23
CS201- Introduction to Programming- Lecture 23CS201- Introduction to Programming- Lecture 23
CS201- Introduction to Programming- Lecture 23
 
CS201- Introduction to Programming- Lecture 35
CS201- Introduction to Programming- Lecture 35CS201- Introduction to Programming- Lecture 35
CS201- Introduction to Programming- Lecture 35
 
CS201- Introduction to Programming- Lecture 24
CS201- Introduction to Programming- Lecture 24CS201- Introduction to Programming- Lecture 24
CS201- Introduction to Programming- Lecture 24
 
Industrialisasi Media
Industrialisasi MediaIndustrialisasi Media
Industrialisasi Media
 
CS201- Introduction to Programming- Lecture 22
CS201- Introduction to Programming- Lecture 22CS201- Introduction to Programming- Lecture 22
CS201- Introduction to Programming- Lecture 22
 
ADEWOYE OMONIYI ADEYEMI PR
ADEWOYE OMONIYI ADEYEMI PRADEWOYE OMONIYI ADEYEMI PR
ADEWOYE OMONIYI ADEYEMI PR
 
CS201- Introduction to Programming- Lecture 13
CS201- Introduction to Programming- Lecture 13CS201- Introduction to Programming- Lecture 13
CS201- Introduction to Programming- Lecture 13
 
CS201- Introduction to Programming- Lecture 11
CS201- Introduction to Programming- Lecture 11CS201- Introduction to Programming- Lecture 11
CS201- Introduction to Programming- Lecture 11
 
TOP Downloaded Papers (January)--International Journal of Computer Networks &...
TOP Downloaded Papers (January)--International Journal of Computer Networks &...TOP Downloaded Papers (January)--International Journal of Computer Networks &...
TOP Downloaded Papers (January)--International Journal of Computer Networks &...
 
World com scandal
World com scandalWorld com scandal
World com scandal
 
Chapter 6 testbench
Chapter 6 testbenchChapter 6 testbench
Chapter 6 testbench
 
Aula6 estresse térmico e zct
Aula6 estresse térmico e zctAula6 estresse térmico e zct
Aula6 estresse térmico e zct
 
pertolongan cemas, anduh, pbsm, pengakap
pertolongan cemas, anduh, pbsm, pengakappertolongan cemas, anduh, pbsm, pengakap
pertolongan cemas, anduh, pbsm, pengakap
 
Osteo osteomalacia ricket2
Osteo osteomalacia ricket2Osteo osteomalacia ricket2
Osteo osteomalacia ricket2
 
CS201- Introduction to Programming- Lecture 04
CS201- Introduction to Programming- Lecture 04CS201- Introduction to Programming- Lecture 04
CS201- Introduction to Programming- Lecture 04
 
Contrarrazoes ro vinculo empregaticio reclamada ilovepdf-compressed
Contrarrazoes ro vinculo empregaticio reclamada ilovepdf-compressedContrarrazoes ro vinculo empregaticio reclamada ilovepdf-compressed
Contrarrazoes ro vinculo empregaticio reclamada ilovepdf-compressed
 

More from Bilal Ahmed

CS201- Introduction to Programming- Lecture 45
CS201- Introduction to Programming- Lecture 45CS201- Introduction to Programming- Lecture 45
CS201- Introduction to Programming- Lecture 45Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 43
CS201- Introduction to Programming- Lecture 43CS201- Introduction to Programming- Lecture 43
CS201- Introduction to Programming- Lecture 43Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 39
CS201- Introduction to Programming- Lecture 39CS201- Introduction to Programming- Lecture 39
CS201- Introduction to Programming- Lecture 39Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 32
CS201- Introduction to Programming- Lecture 32CS201- Introduction to Programming- Lecture 32
CS201- Introduction to Programming- Lecture 32Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 31
CS201- Introduction to Programming- Lecture 31CS201- Introduction to Programming- Lecture 31
CS201- Introduction to Programming- Lecture 31Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 19
CS201- Introduction to Programming- Lecture 19CS201- Introduction to Programming- Lecture 19
CS201- Introduction to Programming- Lecture 19Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 18
CS201- Introduction to Programming- Lecture 18CS201- Introduction to Programming- Lecture 18
CS201- Introduction to Programming- Lecture 18Bilal Ahmed
 
CS201- Introduction to Programming- Lecture 16
CS201- Introduction to Programming- Lecture 16CS201- Introduction to Programming- Lecture 16
CS201- Introduction to Programming- Lecture 16Bilal Ahmed
 

More from Bilal Ahmed (8)

CS201- Introduction to Programming- Lecture 45
CS201- Introduction to Programming- Lecture 45CS201- Introduction to Programming- Lecture 45
CS201- Introduction to Programming- Lecture 45
 
CS201- Introduction to Programming- Lecture 43
CS201- Introduction to Programming- Lecture 43CS201- Introduction to Programming- Lecture 43
CS201- Introduction to Programming- Lecture 43
 
CS201- Introduction to Programming- Lecture 39
CS201- Introduction to Programming- Lecture 39CS201- Introduction to Programming- Lecture 39
CS201- Introduction to Programming- Lecture 39
 
CS201- Introduction to Programming- Lecture 32
CS201- Introduction to Programming- Lecture 32CS201- Introduction to Programming- Lecture 32
CS201- Introduction to Programming- Lecture 32
 
CS201- Introduction to Programming- Lecture 31
CS201- Introduction to Programming- Lecture 31CS201- Introduction to Programming- Lecture 31
CS201- Introduction to Programming- Lecture 31
 
CS201- Introduction to Programming- Lecture 19
CS201- Introduction to Programming- Lecture 19CS201- Introduction to Programming- Lecture 19
CS201- Introduction to Programming- Lecture 19
 
CS201- Introduction to Programming- Lecture 18
CS201- Introduction to Programming- Lecture 18CS201- Introduction to Programming- Lecture 18
CS201- Introduction to Programming- Lecture 18
 
CS201- Introduction to Programming- Lecture 16
CS201- Introduction to Programming- Lecture 16CS201- Introduction to Programming- Lecture 16
CS201- Introduction to Programming- Lecture 16
 

Recently uploaded

Tekoäly ja oppiminen. Airut-hanke 23.4.24
Tekoäly ja oppiminen. Airut-hanke 23.4.24Tekoäly ja oppiminen. Airut-hanke 23.4.24
Tekoäly ja oppiminen. Airut-hanke 23.4.24Matleena Laakso
 
Valkohäntäpeura (Odocoileus virginianus).pptx
Valkohäntäpeura (Odocoileus virginianus).pptxValkohäntäpeura (Odocoileus virginianus).pptx
Valkohäntäpeura (Odocoileus virginianus).pptxpurmonen8
 
Tekoäly ja opinto-ohjaus, webinaari 26.4.24
Tekoäly ja opinto-ohjaus, webinaari 26.4.24Tekoäly ja opinto-ohjaus, webinaari 26.4.24
Tekoäly ja opinto-ohjaus, webinaari 26.4.24Matleena Laakso
 
Tekoäly opetuksessa. Seinäjoen lyseo 24.4.24
Tekoäly opetuksessa. Seinäjoen lyseo 24.4.24Tekoäly opetuksessa. Seinäjoen lyseo 24.4.24
Tekoäly opetuksessa. Seinäjoen lyseo 24.4.24Matleena Laakso
 
Opettaja ja tekoäly. Pedaiiltapäivä 25.4.24
Opettaja ja tekoäly. Pedaiiltapäivä 25.4.24Opettaja ja tekoäly. Pedaiiltapäivä 25.4.24
Opettaja ja tekoäly. Pedaiiltapäivä 25.4.24Matleena Laakso
 
Avoimen jakamisen ylistys, ITK 19.4.2024
Avoimen jakamisen ylistys, ITK 19.4.2024Avoimen jakamisen ylistys, ITK 19.4.2024
Avoimen jakamisen ylistys, ITK 19.4.2024Matleena Laakso
 

Recently uploaded (6)

Tekoäly ja oppiminen. Airut-hanke 23.4.24
Tekoäly ja oppiminen. Airut-hanke 23.4.24Tekoäly ja oppiminen. Airut-hanke 23.4.24
Tekoäly ja oppiminen. Airut-hanke 23.4.24
 
Valkohäntäpeura (Odocoileus virginianus).pptx
Valkohäntäpeura (Odocoileus virginianus).pptxValkohäntäpeura (Odocoileus virginianus).pptx
Valkohäntäpeura (Odocoileus virginianus).pptx
 
Tekoäly ja opinto-ohjaus, webinaari 26.4.24
Tekoäly ja opinto-ohjaus, webinaari 26.4.24Tekoäly ja opinto-ohjaus, webinaari 26.4.24
Tekoäly ja opinto-ohjaus, webinaari 26.4.24
 
Tekoäly opetuksessa. Seinäjoen lyseo 24.4.24
Tekoäly opetuksessa. Seinäjoen lyseo 24.4.24Tekoäly opetuksessa. Seinäjoen lyseo 24.4.24
Tekoäly opetuksessa. Seinäjoen lyseo 24.4.24
 
Opettaja ja tekoäly. Pedaiiltapäivä 25.4.24
Opettaja ja tekoäly. Pedaiiltapäivä 25.4.24Opettaja ja tekoäly. Pedaiiltapäivä 25.4.24
Opettaja ja tekoäly. Pedaiiltapäivä 25.4.24
 
Avoimen jakamisen ylistys, ITK 19.4.2024
Avoimen jakamisen ylistys, ITK 19.4.2024Avoimen jakamisen ylistys, ITK 19.4.2024
Avoimen jakamisen ylistys, ITK 19.4.2024
 

CS201- Introduction to Programming- Lecture 30

  • 2. In TTooddaayy’’ss LLeeccttuurree – References – DDiiffffeerreenncceess BBeettwweeeenn RReeffeerreenncceess aanndd PPooiinntteerrss
  • 4. &&
  • 5. iinntt && ii ;; ‘‘ii’’ iiss aa rreeffeerreennccee ttoo aann iinntteeggeerr iinntt ** ii ;; ‘‘ii’’ iiss aa ppooiinntteerr ttoo aann iinntteeggeerr
  • 6. iinntt ii ;; iinntt && jj == ii ;;
  • 7. EExxaammppllee mmaaiinn ( ) 11 {{ iinntt ii ;; iinntt && jj == ii ;; ii == 112233 ;; OOuuttppuutt ccoouutt <<<< ii <<<< eennddll ;; 112233 ccoouutt <<<< jj <<<< eennddll ;; 112233 ii++++ ;; ccoouutt <<<< ii <<<< eennddll ;; 112244 ccoouutt <<<< jj ;; 112244 }}
  • 8. EExxaammppllee 22 vvooiidd sswwaapp (( iinntt xx ,, iinntt yy )) {{ iinntt tteemmpp == xx ;; xx == yy ;; yy == tteemmpp ;; }}
  • 9. EExxaammppllee 22 mmaaiinn (( )) {{ iinntt xx ,, yy ;; xx == 1100 ;; yy == 2200 ;; sswwaapp (( xx ,, yy )) ;; ccoouutt <<<< xx <<<< yy ;; }}
  • 10. EExxaammppllee 22 mmaaiinn (( )) {{ iinntt xx ,, yy ;; xx == 1100 ;; yy == 2200 ;; sswwaapp (( && xx ,, && yy )) ;; ccoouutt <<<< xx <<<< yy ;; }}
  • 11. swap (( iinntt ** ii ,, iinntt ** jj )) ;;
  • 12. EExxaammppllee 22 void swap ( iinntt ** ii ,, iinntt ** jj )) {{ iinntt ** tteemmpp == ii ;; ** ii == ** jj ;; ** jj == ** tteemmpp ;; }}
  • 13. EExxaammppllee 33 void swap ( iinntt && ii ,, iinntt && jj )) {{ iinntt tteemmpp == ii ;; ii == jj ;; jj == tteemmpp ;; }}
  • 14. EExxaammppllee 33 mmaaiinn (( )) {{ iinntt xx ,, yy ;; xx == 1100 ;; yy == 2200 ;; sswwaapp (( xx ,, yy )) ;; ccoouutt <<<< xx <<<< yy ;; }}
  • 16. EExxaammppllee 44 ssttrruucctt bb {{ iinntt sseerrnnoo ;; cchhaarr tteexxtt [[ 11000000 ]] ;; //// AA lloott ooff cchhaarrss }} bb == {{ 112233,, "TThhiiss iiss aa BBIIGG ssttrruuccttuurree" }} ;; vvooiidd vvaallffuunncc (( bb )) ;; //// CCaallll bbyy vvaalluuee vvooiidd ppttrrffuunncc (( ** bb )) ;; //// CCaallll bbyy ppooiinntteerr vvooiidd rreeffffuunncc (( && bb )) ;; //// CCaallll bbyy rreeffeerreennccee
  • 17. EExxaammppllee 44 vvooiidd mmaaiinn (( )) {{ vvaallffuunncc (( bb )) ;; //// PPaassssiinngg tthhee vvaarriiaabbllee iittsseellff ppttrrffuunncc (( && bb )) ;; //// PPaassssiinngg tthhee aaddddrreessss ooff tthhee vvaarriiaabbllee rreeffffuunncc (( bb )) ;; //// PPaassssiinngg aa rreeffeerreennccee ttoo tthhee vvaarriiaabbllee }}
  • 18. EExxaammppllee 44 ssttrruucctt bb {{ iinntt sseerrnnoo ;; cchhaarr tteexxtt [[ 11000000 ]] ;; //// AA lloott ooff cchhaarrss }} bb == {{ 112233 ,, "TThhiiss iiss aa BBIIGG ssttrruuccttuurree" }} ;; vvooiidd vvaallffuunncc (( bb )) ;; //// CCaallll bbyy vvaalluuee vvooiidd ppttrrffuunncc (( ccoonnsstt ** bb )) ;; //// CCaallll bbyy ppooiinntteerr vvooiidd rreeffffuunncc (( ccoonnsstt && bb )) ;; //// CCaallll bbyy rreeffeerreennccee
  • 20. mmaaiinn (( )) {{ iinntt ii ;; iinntt && rreeffii == ii ;; ccoouutt <<<< ““TThhee aaddddrreessss ooff tthhee rreeffeerreennccee iiss ”” <<<< && rreeffii ;; ccoouutt <<<< && ii ;; }}
  • 22. References aass RReettuurrnn iinntt mmyynnuumm == 00 ;; ///V/V GGaalloolbbluuaall eevvaassrriiaabbllee iinntt && nnuumm (( )) {{ rreettuurrnn mmyynnuumm ;; }} vvooiidd mmaaiinn (( )) {{ iinntt ii ;; mmyynnuumm == 110000 ;; ii == nnuumm (( )) ;; nnuumm (( )) == 220000 ;; }}
  • 23. iinntt && ii ;; ddoouubbllee && ff ;; cchhaarr && cc ;;
  • 24. aa == bb == cc ;;
  • 25. aa == bb ;;
  • 26. cout << ““TThhee vvaalluueess ooff tthhee iinntteeggeerr iiss ””<<<< ii <<<< eennddll ;;