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

book
Introduction to References

A reference is an alias, or an alternative name, for an existing variable. It provides a way to access the value of a variable indirectly through another name. They do not have a memory address of their own. Instead they refer to the memory address of the variable they are referencing.

h

reference

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

Now referenceVariable is an alias for originalVariable. The primary purpose of references is to simplify and make safe, more readable code and avoid unnecessary memory overhead.

Advantages of Reference

question mark

What is false about the references?

Select the correct answer

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 3. Capítulo 1

Pergunte à IA

expand
ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

some-alt