title: Assigning data to array using curly brackets
body: <p>In the C language, why does the following expression fail?</p>
  
  <pre><code>map = malloc(sizeof(Map) * tiles);
  map = {
      0,2,0,0,0,0,0,0,2,0,
      0,1,0,0,0,0,0,0,1,0,
      0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,
      0,0,0,0,0,0,0,0,0,0,
      2,1,0,0,0,0,0,0,1,2,
      0,0,0,0,0,0,0,0,0,0
  };
  </code></pre>
  
  <p>I just want to fill data in such a "row/column" format into a C array. However, the compiler fails with </p>
  
  <pre><code>error: expected expression before ‘{’ token
  </code></pre>
  
  <p>(in the map = { line). Filling the array in other ways works fine, and I am sure the brackets work for initializations...I can't do that after I have allocated memory?</p>
  
  <p>EDIT: I solved it by making a temporary char array and then feeding the data to the malloced map in a for loop.
  Still. I'd like to know why the above code would leak memory as pointed below. And would my fix (parsing the temp array and setting the map data with it) leak memory as well?</p>