If you want to treat the number as an array of char
, you can take the address and cast the pointer:
int i;
double d;
char * ic = (char *) &i;
char * dc = (char *) &d;
then ic
and dc
are pointers to char
. They aren't zero-terminated, so you can't use them as strings, but they can be used as arrays.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…