title: Converting an int to a char in C
body: <pre><code>#include&lt;stdio.h&gt;
  
  char* intToString(int N);
  int power(int N, int M)
  {   
      int n = N;
      if (M ==0) return 1;
      int i;
      for( i = 1; i &lt; M; i++)
          N*=n;
      return N;
  }
  
  int main()
  {
     printf("%s",intToString(100));
  }
  
  char* intToString(int N)
  {   
     float M = N;
     int numberLen = 1;
     while(M &gt; 1) 
     { 
        M /= 10;numberLen++;
     }
     int ar[numberLen];
     char str[numberLen + 1];
     int i;
     for(i = 0; i &lt; numberLen; i++)
     {
        str[numberLen - i - 1] = (N%power(10,i+1))/(power(10,i));
     }
     str[numberLen] = '\0';
     return str; 
  }
  </code></pre>
  
  <p>I am trying to solve the Euler project problems in C. I have run into a little issue here, when I run this program I get a square with some numbers in it as oppose to a string "100". </p>