- #1
member 428835
Hi PF!
The following runs if lines 5 and 11 are commented, but fails otherwise. Can someone explain what's happening here? Something with scope but I'm very lost. Thanks in advance!
The following runs if lines 5 and 11 are commented, but fails otherwise. Can someone explain what's happening here? Something with scope but I'm very lost. Thanks in advance!
C++:
#include <iostream>
int main()
{
{
int* i = new int;
{
int b = 5;
i = &b;
}
}
std::cout<< *i;
return 0;
}