Basically the program will ask for user credit card number, capture it inside a string, convert a string to an integer array (so I can validate credit card number, for later digit sums and multiplying).
I need a variable with integers array and the code below stores ASCII values.
Tried reading lots of posts, but didn't get it.
I'd appreciate any help, so I could sleep again =)
int main (void)
printf("Please enter a credit card number:\n");
//Captures credit card string
cc_string = GetString();
// Array of credit card digits integers
for (int i = 0; i<= 15; i++)
cc_digits[i] = (int) cc_string[i];
//Just checking what value has been stored
printf("position %d with %d \n", i, cc_digits[i]);
//to be continued
cc_digits[i] = (int) cc_string[i] try
cc_digits[i] = cc_string[i] - '0' If you just cast to
int you'll get the ASCII code for the character, but if you subtract the code of character
0 then you should get the actual digit.