Quantcast
Channel: Active questions tagged crash - Stack Overflow
Viewing all articles
Browse latest Browse all 7193

Why C++ Recognizes an uninitialized Raw Pointer (or say a daemon) as true?

$
0
0

Why the following code produces a SEGMENTATION FAULT!!!

//somewhere in main ... int *pointer; if(pointer) cout << *pointer; ...

But slightly changed following code doesn't

//somewhere in main ... int *pointer = nullptr; if(pointer) cout << *pointer; ... the question is what in C++ makes an uninitialized pointer true - and leads to a crash!


Viewing all articles
Browse latest Browse all 7193

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>