117. Printing binary of float using character pointer.
#include<stdio.h>
int
pos;
char
*cp;
float
f=23.5;
void
main()
{
cp=(char *)&f;
for(cp=cp+3;cp>=(char *)&f;cp--)
for(pos=7;pos>=0;pos--)
printf("%d",*cp>>pos&1);
}
Comments
Post a Comment