title: error: non-const static data member must be initialized out of line
body: <pre><code>class Solution {
      public:
  
       static int m=INT_MIN; // it shows error: non-const static data member must 
                                 be initialized out of line.(why?)
                                    using "int m=INT_MIN" is fine. 
        int func(TreeNode*root){
          if(root==NULL){
              return 0;
          }
  
          int l=max(func(root-&gt;left),0);
          int r=max(func(root-&gt;right),0);
  
          m=max(l+r+root-&gt;val,m);
  
          return max(l,r)+root-&gt;val;
  
      }
  
  
      int maxPathSum(TreeNode* root) {
  
          if(root==NULL)
          {
           return 0;
          }
          m=INT_MIN;
          int x=func(root);
          return m;
  
      }
  };
  </code></pre>
  
  <p>I need to update the value of variable <code>m</code>. Therefore I am using <code>static int</code> data type. But the following error is coming.
   Using <code>int</code> instead of <code>static int</code> is working fine. But why is <code>static int</code> giving error?</p>
  
  <p><img src="https://i.stack.imgur.com/Vd6VH.png" alt="compilation error"></p>