When you say "... represent an integer", do you mean the
int type? If so, then what you want is
(I realize this snippet makes the implementation-dependent assumption that sizeof returns the size in 8-bit bytes.)
If instead you want to know the minimum number of bits needed to represent some particular integer value, say "452", then you're out of luck. You will have to write your own bit-counting function to do that.