title: How to rotate a section of a 1d array in C?
body: <p>I printed out a 6x6 1d array but want to rotate counter-clockwise the top left 3x3 section. Is there an algorithm for this? In the future I also want to rotate like the bottom right 3x3 section or the top right 3x3 section or the bottom left 3x3 section. </p>
  
  <pre><code>a[0]  a[1]  a[2]  a[3]  a[4]  a[5]         a[1]  a[2]  a[8]  a[3]  a[4]  a[5]
  a[6]  a[7]  a[8]  a[9]  a[10] a[11]        a[0]  a[7]  a[14] a[9]  a[10] a[11]
  a[12] a[13] a[14] a[15] a[16] a[17]  ---&gt;  a[6]  a[12] a[13] a[18] a[19] a[20]
  a[18] a[19] a[20] a[21] a[22] a[23]        a[18] a[19] a[20] a[21] a[22] a[23]
  a[24] a[25] a[26] a[27] a[28] a[29]        a[24] a[25] a[26] a[27] a[28] a[29]
  a[30] a[31] a[32] a[33] a[34] a[35]        a[30] a[31] a[32] a[33] a[34] a[35]
  </code></pre>