I am expecting the output to be 10 But i get 11 as per my knowledge while calling fun function, it should take the global variable. ??
#include <iostream>
using namespace first;
int var = 0;
void fun()
{
cout << var;
}
int main()
{
var = 1;
cout << var;
fun();
}