title: expression did not evaluate to a constant- c++
body: <p>I wrote the following code for converting a decimal number to base2.
  not the best one probably, but it worked on eclipse.
  however, when I try to run it on visual studio, I get this error message on line 10 (emphasized): "expression did not evaluate to a constant".
  Why is that?</p>
  
  <pre><code>long base2(int number) {
      int remainder, sizeOfRetNum, isNegative = 0;
      if (number&lt;0)
          isNegative = 1;
      int temp = number;
      while (temp != 0) {
          sizeOfRetNum++;
          temp = temp / 2;
      }
      char ansString[sizeOfRetNum]; // ********line 10********
      int j = sizeOfRetNum - 1;
      while (number != 0) {
          remainder = number % 2;
          number = number / 2;
          if (remainder == 0)
              ansString[j] = '0';
          else
              ansString[j] = '1';
          j--;
      }
      long ansNum = atol(ansString);
      if (isNegative == 1)
          ansNum = -ansNum;
      return ansNum;
  }
  </code></pre>