Q&A
Ask and answer questions to make information more available to wider audiences.
Caiden Albright @albrightcaiden   07, Apr 2023 12:00 AM
references in C++
What are references in C++?
answers 1
 
Answer 1
Jett Deane @deanejett   08, Apr 2023 09:10 AM
When a variable is described as a reference it becomes an alias of the already existing variable. In simple terms, a referenced variable is another named variable of an existing variable keeping in mind that changes made in the reference variable will be reflected in the already existing variable. A reference variable is preceded with a ‘&’ symbol.
Syntax:
int GFG = 10;
// reference variable
int& ref = GFG;