If i assign value with call fun1() the x variable outside lambda will be broken (unable to read memory), but if I run fun2() everything is good. Why? Copy of pointer still points to the same thing right? Then why does fun1() does not work?
int *x = NULL;
auto fun1 = [x]() mutable
{
x = new int(5);
};
auto fun2 = [&x]()
{
x = new int(5);
};