The +0x30 is a trick to avoid having to call itoa() to convert each digit from an int to a char - the digits 0~9 are ASCII codes 0x30~0x39 - so you can just add 0x30 to the digit to get the ascii character for it.
Or maybe they've just never heard the term "modulo math". A term which incidentally doesn't appear on that page or anywhere else in Wikipedia. One did ask if I meant modular arithmetic and I didn't know. I still don't.
No, I'm learning on my own. You maybe right that itoa() is an easier way to do it, but since a number of people have suggested the modulo method I wanted to learn how that works. I find it best to stay focused on one thing until I get it, then try other methods. I asked for a specific method because I wanted to learn it.
slipstick:
Or maybe they've just never heard the term "modulo math". A term which incidentally doesn't appear on that page or anywhere else in Wikipedia. One did ask if I meant modular arithmetic and I didn't know. I still don't.
UKHeliBob:
I am still not clear what you want to do.
Should the entries in the array be numbers as you have written or characters representing numbers ?
That's what threw me. The last number is a zero, so it looks like an attempt to make the cstring "98". But yes, it's not ASCII as shown.
The +0x30 is a trick to avoid having to call itoa() to convert each digit from an int to a char - the digits 0~9 are ASCII codes 0x30~0x39 - so you can just add 0x30 to the digit to get the ascii character for it.
It would certainly be simpler, and, in my mind, far more intuitive, to use '0' instead of 0x30 or 48.