home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 1
/
FishNMoreVol1.bin
/
more
/
code_examples
/
librar
/
showbits.c
< prev
next >
Wrap
Text File
|
1989-02-08
|
640b
|
27 lines
/*--------------------------------------*/
/* */
/* SHOWBITS(X,X) */
/* */
/* Displays the bit representation of */
/* the integer given in the first argu- */
/* ment in the character array given in */
/* the second argument. */
/* */
/*--------------------------------------*/
void showbits(a,c)
int a;
char c[8];
{
int j,d,e;
d=a;
for (j=0;j<8;j++){
e=power(2,7-j);
if (d>=e){
c[j]=49;
d-=e;
}
else
c[j]=48;
}
}