On Jul 3, 6:51 pm, viza <tom.v...@gm-il.com.obviousc hange.invalid>
wrote:
>
>
Let me space it out a bit:
>
do {
char hexidecimal_dig its[]= {'0','1','2', ...etc };
>
p= p - 1;
>
*p= hexidecimal_dig its[ num % base ];
>
The only bit of maths that you might not understand is that ( num %
base ) means the remainder when num is divided by base.
I have just never seen ( not that that necessarily means anything) a
char array initialized like that. I am curious as to how you get from
this ("0123456789abc def"[num % base];) to this (char
hexidecimal_dig its[]= {'0','1','2', ...etc };). ( The math is fine
( viz the modulo operator). Thank you for your help.
wrote:
do {
*--p = "0123456789abcd ef"[num % base]; << -------This
*--p = "0123456789abcd ef"[num % base]; << -------This
line has me confused? If someone could help, I will appreciate it.
Let me space it out a bit:
>
do {
char hexidecimal_dig its[]= {'0','1','2', ...etc };
>
p= p - 1;
>
*p= hexidecimal_dig its[ num % base ];
>
The only bit of maths that you might not understand is that ( num %
base ) means the remainder when num is divided by base.
I have just never seen ( not that that necessarily means anything) a
char array initialized like that. I am curious as to how you get from
this ("0123456789abc def"[num % base];) to this (char
hexidecimal_dig its[]= {'0','1','2', ...etc };). ( The math is fine
( viz the modulo operator). Thank you for your help.
Comment