Need clarity on below program,
<p>What will the below program print?   </p>

<pre><code>#include &lt;iostream&gt; 
using namespace std;    

static int x = 10;

void main1()    
{      
    cout &lt;&lt; x &lt;&lt; endl;    
    x = x + 1;    
}    

int main()   
{    
    main1();    
    main1();        
    cout &lt;&lt; x &lt;&lt; endl;    
}
</code></pre>

<p>As per my understanding, the above program we used static variable, so <code>x</code> retains the last initialized variable. So the output will be     </p>

<pre><code>10    
11    
12
</code></pre>

<p>but if we removed static, we should get   </p>

<pre><code>10    
10    
10
</code></pre>

<p>but I am getting the below output, even after removing static.</p>

<pre><code>10    
11    
12
</code></pre>

<p>Please help me to understand.</p>
