Is it possible in C?
Is there a certain formula?
Is there a certain formula?
int test = 23;
char bin[10];
char *p = &bin[8];
bin[9] = '\0';
int mask = 1;
while( mask != 512 ) {
if( mask & test )
*p-- = '1';
else
*p-- = '0';
mask <<= 1;
}
printf("%d -> %s\n",test,bin);
int test = 23;
char bin[10];
char *p = &bin[8];
bin[9] = '\0';
int mask = 1;
while( mask != 512 ) {
if( mask & test )
*p-- = '1';
else
*p-- = '0';
mask <<= 1;
}
printf("%d -> %s\n",test,bin);
Comment