Is it allowed to use a pointer's name of a pointer once deleted?
This code, for instance, won't compile.
int hundred = 100;
int * const finger = &hundred;
delete finger;
int * finger = new int; // error: conflicting declaration 'int* finger'
This won't either:
int hundred = 100;
int * const finger = &hundred;
delete finger;
int finger = 50; // error: conflicting declaration 'int finger'
Aucun commentaire:
Enregistrer un commentaire