title: printing an string in cross manner using c program
body: <p>I'am trying to write a program for converting the given string in cross manner(i.e Diagonal from left-right and from right-left). If the string length is even it returns a message else arrange it in a cross form.</p>
  
  <p>The code is:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;string.h&gt;
  
  int main()
  {   
  
      char str[50];
      char str2[50][50];
      int lenstr;
      int i,j;
      char temp;
  
      printf("Enter the string :\n");
      scanf("%s",str);
      lenstr = strlen(str);
      if(lenstr %2 == 0)
      {
          printf("The string length must be an odd length");
  
      }
  
      else
      {
          j = 0;
          temp = 0;
  
          for(i = 0;i == lenstr;i++)
          {
                str2[i][j] = str[i];
                j = j + 1;
          }
  
          for(i = lenstr; i==0 ;i--)
          {
                j = lenstr;
                str2[i][j] =  str[temp];
                temp = temp + 1;
                j = j - 1;
  
          }
  
          for(i = 0;i&lt;lenstr;i++)
          {
  
               for(j = 0;j&lt;lenstr;j++)
               {
  
                   printf("%c",str2[i][j]);
               }
  
               printf("\n");
  
            }
  
       }
  
       return 0;
  
  }
  </code></pre>
  
  <p>The output to the program must be for example: geeks</p>
  
  <pre><code>g       g
    e   e
      e 
    k   k 
  s       s
  </code></pre>
  
  <p>But the output obtained consists of different shapes(like heart,smiley face etc...). Explain the concept behind to correct it and if can please explain when using pointers for the same program. Any help appreciated.  </p>