Professional Documents
Culture Documents
Lect 9 References in C++
Lect 9 References in C++
CSC 404
Complex Networks Research
Object Oriented Programming
Group (CNeRG),
Department of Computer Science
Definition of alias:
and: Engineering
otherwise called
otherwise known as —
used to indicate an additional name that a
person (such as a criminal) sometimes uses Subrata Nandi
John Smith alias Richard Jones was identified
Dept. of Computer Science & Engineering
as the suspect Team Members: NIT Durgapur
National
INDIAN InstituteOF
INSTITUTE of TECHNOLOGY
Technology Sandip Chakraborty, Niloy Ganguly, Basabdatta Palit,
KHARAGPUR
Durgapur Nibir Pal, Somesh Khandelia
Indian Institute of Technology Kharagpur
Outline
• Basics of Pointers
• Pointer Variables – use of & and * operator
• Multiple indirections
• Legal & Illegal Operations on Pointers
• Constants in C++
• Pointers vs Constants
• Arrays vs Pointers
• Reference variables
• Use of reference variables
• Reference vs constants
• Function Pointers
• Constants in C++
• Pointers vs Constants
• Arrays vs Pointers
• Reference variables
• Use of reference variables
• Reference vs constants
• Function pointers
Pseudonyms include stage-names(actors) and user names, ring names, pen-names(writers), nicknames,
aliases, superhero/villain identities(actors) and code names(hackers), gamer identifications
A pseudonym or alias is a fictitious name that a person or group assumes for a particular purpose, which
differs from their original or true name (orthonym)
Objective to remain anonymous
2
variable’s location in memory then you may consider reference
to be another label attached to that memory location
2
to be another label attached to that memory location
2
to be another label attached to that memory location
z
• One may access the location either by the original name or by
it’s reference
cout<<x<<y<<z<<endl;
3
to be another label attached to that memory location
z
• One may access the location either by the original name or by
it’s reference
cout<<x<<y<<z<<endl;
y++;
cout<<x<<y<<z<<endl;
•
Once a reference name is assigned it cannot be used by others
int &a[10];
• int &a=3; // error: cannot bind non-const lvalue reference of type ‘int&’ to an rvalue of type ‘int’