title: C Programming: After making 2 dimensional array, how to assign a set of integers to a row by row?
body: <p>I am practicing a 2 dimensional array.</p>
  <p>Although I want to assign a set of numbers to a row by row, which of 2 dimensional array has already been made, my code can not be compiled.</p>
  <p>How can I achieve my purpose, and what is my mistake?</p>
  <p>Thank you for your reading my question.</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  
  int main(void)
  {
  
      int **animation;
      int rows = 3;
      int cols = 7;
      int y, x;
      int frame;  
  
      animation = (int **) malloc(rows * sizeof(int *));
      if (animation == NULL) {
          puts(&quot;array animation rows: allocation failure!&quot;);
          return 1;
  
      }
  
      for (y = 0; y &lt; rows; y = y + 1) {
          animation[y] = (int *) malloc(cols * sizeof(int));
  
          if (animation[y] == NULL) {
              printf(&quot;array animation[%d]: allocation failure!&quot;, y);
              return 1;
          }
  
      }
  
  
      int animation[0] = {0, 40, 48, 118, 48, 41, 0}; 
      int animation[1] = {40, 48, 118, 48, 41, 0, 0};
      int animation[2] = {40, 48, 118, 48, 41, 0, 0}; 
  
      for (frame = 0; frame != 3; frame = frame + 1) {
  
          printf(&quot;%s\n&quot;, animation[frame]);
      
      }
  
  
  
      for (y = 0; y &lt; rows; y = +1) {
          free(animation[y]);
      }
  
      free(animation);
      
      return 0;   
  
  }
  </code></pre>