I am trying to understand the number representations in c. If I declare a int number=0;
and then assign it a value in binary representation i.e. number= 0b0010
, how can I print out 0010
using printf
?
Also how can we figure out say the 2nd position of 0010
, which in this case is 0? I understand that there is a sprintf
function for converting numbers to strings, but it seems only for decimal and hex numbers? Thanks for your help!