title: C - index 13 out of bounds for type 'long long
body: <p>Hi I am a complete beginner to C.   I haven't been able to find the answer to the below on any forums. </p>
  
  <p>Why am I getting the out of bounds error.  I've tried changing the type of array between int and long long to see if it makes a difference but hasn't s</p>
  
  <pre><code>#include &lt;cs50.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  
  int main (void)
  {
  
   long long Cardnum;    
   long long n;
      int count = 0;
      printf("Enter Card Number: ");
      scanf("%lld", &amp;Cardnum);
      n = Cardnum;
      while(n != 0)
      {
          // n = n/10
          n /= 10;
          ++count;
      }
      printf("Number of digits: %d\n", count);   
  
      if(count !=13 &amp;&amp; count!=15 &amp;&amp; count!=16)
      {
  
          printf("Invalid\n");
      }
      else     //Run luhns algo
      {
         printf("%lld\n",Cardnum); 
         long long numberArray[count]; 
        int c=0;
        int Digit=Cardnum; 
  
         while(Digit !=0) 
             {
             numberArray[count] = Digit%10;
             Digit/=10;
             c++;    
             }
      }
  
  
  }
  </code></pre>