mardi 5 janvier 2016

How do I change the value of a variable using a dynamic pointer and a smart pointer?

How do I change the value of a variable using a dynamic pointer or a smart pointer ?

int a=5;
int *b= new int(a);
*b=10;

cout<< a;

The output is 5. Is it possible for me to change the value of "a" using a dynamic or smart pointer?

Aucun commentaire:

Enregistrer un commentaire