credit-card-validator
credit-card-validator copied to clipboard
qurey raised in the code
Hello! i have a query in your code why are you taking the difference of 'ccNumber[i] with 48' in the code?
In the code, the character being validated subtracts 48 due to it being a character and not an integer. The ASCII value for each integer character is 48 plus the integer itself. i.e. 48 + 0 = 48, therefore 0 in ASCII is 48. Therefore, the intrinsic cast is casting to the number plus 48. Should have been a comment explaining that in the code.
I feel this issue should be marked as resolved and closed.
48 is the ascii value of char '0' for more reference visit chat gpt