title: Getting strange numerical values when trying to store digits of a string in an array
body: <p>The program is pretty simple. The basic aim of the program is to take a number as input from the user and then store the individual digits of the number in an array. For this my approach is to first convert the input integer number into a string. Then we will iterated through every character of the string and covert the character into a digit and store it in the array.
  First I take the input of the length of the number. Then I take input of the number. Then I convert that integer number into string and then iterate through every position of the string and store the subsequent digit in the array.
  code:</p>
  <pre><code>#include&lt;bits/stdc++.h&gt;
  using namespace std;
  
  int main(){
      int n;
      cin&gt;&gt;n;
      int m;
      cin&gt;&gt;m;
      string s = to_string(m);
      int arr[n];
      int j=0;
      for(auto d:s){
          arr[j] = d-'0';
          j+=1;
      }
      for(int i=0;i&lt;n;i++) cout&lt;&lt;arr[i];
  }
  </code></pre>
  <p>The code works absolutely fine for all numbers which do not begin with '0'. But as soon as I give an input integer like '0135' i get strange array elements like '13532764'.
  Please help me in finding the problem.</p>