Why does the output of this code is 0 10 10.dosnt the variable v without value in both the first and third cases?
#include <iostream>
using namespace std;
void f(bool val)
{
int v;
if(val)v=10;
cout<<v<<endl;
}
int main() {
f(false);
f(true);
f(false);
return 0;
}