title: C code won't finish running
body: <p>I'm very new to C, this is a test program that i'm trying to make work. The purpose is to put the characters from  one dynamically generated matrix into another. The code i've got compiles but never finishes running. </p>
  
  <p>When I comment out the loop at the bottom it will do the printf statement fine, but when I uncomment it it just keeps running and doesn't print. I though C worked sequentially? If something in the loop is broken why is it affecting the printf statement?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  
  void main (void)
  {
  int n,m,i;
  char **matrix = (char**) malloc(m * sizeof(char*));
      for ( i = 0; i &lt; m; i++ )
      {
      matrix[i] = (char*) malloc(n * sizeof(char));
      }
  
  char **oldMatrix = (char**) malloc(m * sizeof(char*));
      for ( i = 0; i &lt; m; i++ )
      {
      oldMatrix[i] = (char*) malloc(n * sizeof(char));
      }   
  
  n=1; 
  m=2;    
  int indc;
  matrix[n][m];
  matrix[1][1]='1';
  matrix[1][2]='2';
  oldMatrix[1][2];
  printf("%c %c",matrix[1][1],matrix[1][2]);
  
  int r=0;    
  
              for (indc=0; indc&lt;=1; indc++)
              {
              printf("4");
              oldMatrix[r][indc]=matrix[r][indc];
              }
  
  }
  </code></pre>