void prnBits(unsigned int val){
for(int i = sizeof(unsigned int)*8-1; i>=0;printf("%d", !!(val & (1<<i--))));
}
I’m confused about the "sizeof (unsigned int) * 8 -1".........Why should multiplied by 8....
Tuesday, 13 March 2012
Monday, 12 March 2012
How is works.....Walkthrough w4
const char * w4(float val, char ch){
static char bar[81];
int i;
for(i = 0; i<val && i<80;i++){
bar[i] = ch;
}
bar[i] = 0;
return bar;
}
static char bar[81];
int i;
for(i = 0; i<val && i<80;i++){
bar[i] = ch;
}
bar[i] = 0;
return bar;
}
Wednesday, 25 January 2012
Subscribe to:
Posts (Atom)