How can I catch Null Referencee Pointer exception | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 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 ответ
+ 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