Joke Collection Website - Public benefit messages - Use c language programming to find the verification code of the 18-digit ID card

Use c language programming to find the verification code of the 18-digit ID card

In addition to what was said above, I would like to add one more point

1: char id[19]; ??//The last byte is used for '\0'

2: In addition to this reason, another more important thing is that gets gets all characters, in your jisuan function, in the for loop

result+=((*p)*(* q));

This sentence is actually the multiplication of the ASCII codes of the characters, not the multiplication of numbers. It can be changed to

(((*p) - '0' ) * ((*q) - '0'));

This is the multiplication of the numbers corresponding to the characters (is this easy to understand?)

3: Although jisuan returns is a relatively small number, but when calculating in a for loop, defining the result as char type will cause overflow, which will affect your results. I suggest changing it to unsigned int