I'm getting a stack overflow error message when running the below code, but ONLY when more than 6 digits are entered. I think the code is fairly simple and all I've been able to find in the way of help so far are answers about "memory allocation" which I don't yet have any concept of.
int main(void)
{
printf("Please enter card number for check: \n");
long long credit_card = GetLongLong();
int card_length = log10(credit_card)+1;
int cred_array[card_length];
long long dec = 1;
int i;
printf("credit_card: %lli\n",credit_card);
printf("card_length: %i\n",card_length);
for (i = (card_length-1); i>-1; i--)
{
cred_array[i]=(credit_card/dec)%10;
dec *=10;
}
int luhn_array[(credit_card-(credit_card % 2)) / 2][2];
int j;
int n = 0;
for(j = card_length-2; j >= 0; j-=2)
{
luhn_array[n][0]=cred_array[j]*2%10;
luhn_array[n][1]=cred_array[j]*2/10;
n++;
}
}