Why does the program crashes if a pointer is left uninitialized in c++ ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why does the program crashes if a pointer is left uninitialized in c++ ?

7th Oct 2019, 5:07 AM
Manoj Sarangi
Manoj Sarangi - avatar
2 Answers
+ 3
If you try to dereference an uninitialised pointer you will get a segmentation fault because you are trying to access unallocated memory.
7th Oct 2019, 6:32 AM
Sonic
Sonic - avatar
+ 1
We try to access Unallocated memory which cause error
7th Oct 2019, 10:57 AM
Priya Trikoti
Priya Trikoti - avatar