#include <iostream>
int main()
{
int* i = 0;
int x = (*i);
std::cout << x;
}
The above program will crash when I compile and run it using Visual Studio 2010
and I know it crashes because I set the pointer to 0.
What I would like to know, is accessing a null pointer
in C++ defined in the standard or is it undefined and I just happen to get lucky that my program crashed because of my compiler/computer/operating system
If it is defined, what does C++ guarantee me when I try and access a null pointer?