NULL pointer | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

NULL pointer

Could anyone explain null pointer..

16th May 2020, 6:50 PM
Kumudu_Mohottala
Kumudu_Mohottala - avatar
1 Answer
+ 2
If you want a pointer to point nowhere, you can give it the value 'nullptr'. Normally when you declare a pointer but you don't initialize it, it may just point somewhere (and you are not certain what is located at that memory location). But if you assign the value 'nullptr' to the pointer, it just points nowhere. The advantage is that you (for example) don't accidentally alter the memory at some random memory location
16th May 2020, 7:26 PM
DeX97