How can I catch Null Referencee Pointer exception | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

How can I catch Null Referencee Pointer exception

I want m'y pointer to be read only if he has a value

26th Dec 2016, 6:23 AM
Mattis BETOURNE Clara HORVENO
Mattis BETOURNE Clara HORVENO - avatar
1 Réponse
+ 1
You should set all of your pointers to nullptr when being deleted or allocated, so then you can just ask: if (pointer==nullptr) throw -1;
26th Dec 2016, 8:14 AM
Faris Hasković
Faris Hasković - avatar