title: How to turn 2d array out of 1d one?
body: <p>To access any element I use <code>*(Ptr + i)</code>. </p>
  
  <p>Is there any way to put 2D array into the allocated memory in order to access any element using <code>array[i][j]</code>?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main()
  {
     int *Ptr;
  
     Ptr = malloc(M*N*sizeof(int));
  
     for (i = 0; i &lt;= M * N; i++)
        *(Ptr + i) = 1 + rand()%10;
  
     return 0;
  }
  </code></pre>