References and Pointers
References
References provide an alias for an existing variable. We can manipulate the original value using the reference variable. The reference variable is declared using & operator.
Example
int originalVariable = 12;
// A reference variable to originalVariable
int& referenceVariable = originalVariable;
referenceVariable is reference to originalVariable.
A pointer is a variable that stores the memory address of another variable. It can be created using the * operator and the address of another variable can be assigned using the address-of operator &.
Example
int i = 3;
// A pointer to variable i or "stores the address of i"
int *ptr = &i;
C++ Cheatsheet
This is a C++ programming cheat sheet. It is useful for beginners and intermediates looking to learn or revise the concepts of C++ programming. While learning a new language, it feels annoying to switch pages and find different websites for different concepts that are easily understandable. You can learn C++ concepts very easily using this cheat sheet.
C++ is a high-level programming language. It was developed in 1983 by Bjarne Stroustrup at Bell Labs. It is used for developing various applications.
Contact Us