Based on my basic knowledge about C++, I assumed following code will have run-time error. Because compiler has not allocate any space for the y pointer, and I should add the y = new int; before assigning value to y pointer.
Am I wrong or compiler has allocate space for y pointer implicitly? (I compiled my code with Dev-C++ 4.9.9.2.)
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int* x;
int* y;
x = new int;
*x = 42;
cout << *x << "\n";
*y = 13;
cout << *y << "\n";
}