Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Features | References & Pointers
C++ Intermediate | Mobile-Friendly

bookFeatures

If we write some new data to a pointer or a link, then this will also be reflected in the variable to which they point.

Pointers:

123456
int a = 2; int *pa = &a; cout << a << endl; *pa = 50; cout << a;
copy

References:

123456
int a = 2; int &ra = a; cout << a << endl; ra = 50; cout << a;
copy
question-icon

Rewrite the variable x using the reference and the pointer in this order.

int x = 42;
int *px = &x;
int &rx = x;

 = 3;
cout<<
<< endl;

=2;
cout<<
;
3
2

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 8

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

Suggested prompts:

Posez-moi des questions sur ce sujet

Résumer ce chapitre

Afficher des exemples du monde réel

Awesome!

Completion rate improved to 2.94

bookFeatures

Glissez pour afficher le menu

If we write some new data to a pointer or a link, then this will also be reflected in the variable to which they point.

Pointers:

123456
int a = 2; int *pa = &a; cout << a << endl; *pa = 50; cout << a;
copy

References:

123456
int a = 2; int &ra = a; cout << a << endl; ra = 50; cout << a;
copy
question-icon

Rewrite the variable x using the reference and the pointer in this order.

int x = 42;
int *px = &x;
int &rx = x;

 = 3;
cout<<
<< endl;

=2;
cout<<
;
3
2

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 8
some-alt