title: Print mirror image of 2D array of characters
body: <p>Please check the problem with this code.<br>
  It is showing compilation error when I'm running it on mycodeschool IDE. 
  problem statement is
  Problem statement
  Given a two dimensional array, print its mirror image if mirror is placed along one of the sides of the array.</p>
  
  <p>Input
  First line of input will contain a number T = number of test cases. Each test case will contain two positive integers n and m (1&lt;=n, m&lt;=50) on a single line separated by space. Next n lines will each contain a string of exactly m characters. Next line will contain a character 'V' or 'H'. If character is V, mirror is placed vertically along the right-most column. If the character is H, the mirror is placed horizontally along the bottom-most row.</p>
  
  <p>Output
  For each test case, print the n*m mirror image - n lines with strings of m character each. Print an extra empty line after output for each test case.</p>
  
  <p>Sample Input
  2
  3 3
  abc
  def
  ghi
  V
  3 4
  1234
  5678
  9876
  H
  Sample Output
  cba
  fed
  ihg</p>
  
  <p>9876
  5678
  1234 </p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;string.h&gt;
  #include&lt;stdlib.h&gt;
  
  int main()
  {
      char a[10][10];
      int i,j,t,m,n;
      char s;
      scanf("%d\n",&amp;t);
      for(j=0;j&lt;t;j++)
      {
      scanf("%d%d\n",&amp;m,&amp;n);
  
      for(i=0;i&lt;m;i++)
      {
          scanf("%s",&amp;a[i]);
      }
  
      scanf("\n%c",&amp;s);
      if(s=='V')//for image along rightmost vertical line
      {
          for(i=0;i&lt;m;i++)
          {
              strrev(a[i]);
          }
  
      }  
      else if(s=='H')//for image along lowermost horizontal line
      {
          int t=0;
          int b=m-1;
          while(t&lt;b)
              {
                  char *temp = (char *)malloc((strlen(a[t]) + 1) *   sizeof(char));//temporary variable to swap
                  strcpy(temp, a[t]);
                  strcpy(a[t], a[b]);
                  strcpy(a[b], temp);
                  free(temp);
                  t++;
                  b--;
              }
          }
  
  for(i=0;i&lt;m;i++)
  {
      printf("%s\n",a[i]);
  }
  printf("\n");}
  return 0;
  }
  </code></pre>