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

bookIntroduction 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

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

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 9

Fråga AI

expand

Fråga AI

ChatGPT

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
some-alt