title: c-language initializing global variable inside main(), outside main()
body: <ol>
  <li><p>inside main() -- no error</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  #define MAX 4
  
  typedef struct
  {
      int vertex;
      int **matrix;
  }graph;
  graph ygraph={.vertex=MAX};
  
  int main()
  {
      ygraph.matrix=(int**)malloc(sizeof(int)*MAX*MAX);
      return 0;
  }
  </code></pre></li>
  <li><p>outside main() -- error//</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  #define MAX 4
  
  typedef struct
  {
      int vertex;
      int **matrix;
  }graph;
  graph ygraph={.vertex=MAX};
  ygraph.matrix=(int**)malloc(sizeof(int)*MAX*MAX);
  
  int main()
  {
      return 0;
  }    
  </code></pre></li>
  </ol>
  
  <p>what is difference...?
  I can't initialize global variable outside main()?
  I think both have no error...</p>