Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Introduction to References | References Fundamentals
C++ Pointers and References

bookIntroduction to References

Sveip for å vise menyen

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

reference.h

copy
12
int originalVariable = 42; int& referenceVariable = originalVariable;

So, when you use referenceVariable, you are actually working with originalVariable.

Advantages of Reference

question mark

What is false about the references?

Select the correct answer

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 1

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

Seksjon 3. Kapittel 1
some-alt