Introduction to References
Svep för att visa menyn
A reference is simply another name for an existing variable. Instead of creating a new variable with its own memory, a reference points to the same memory location as the original variable. This means both names work with the same value.
reference.h
12int originalVariable = 42; int& referenceVariable = originalVariable;
So, when you use referenceVariable, you are actually working with originalVariable.
Advantages of Reference
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 9
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Avsnitt 1. Kapitel 9