I have two tasks for an assignment, one return the number of bits in type int on any machine. I thought I would write my function like so:
int CountIntBitsF() {
int x = sizeof(int) / 8;
return x;
}
Does that look right?
The second part is to return the number of any bits of any data type with a macro, and the macro can be taken from limits.h. I looked up limits.h on my machine, and also http://www.opengroup.org/onlinepubs/007908799/xsh/limits.h.html, but I don't think I really understand how any of those would return the number of bits in any data type. Any thoughts? Thanks.