Introduction to References
Stryg for at vise menuen
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 alt klart?
Tak for dine kommentarer!
Sektion 1. Kapitel 9
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Sektion 1. Kapitel 9