In C, how to convert an integer to binary?
There is no standard function in C to convert or display an integer in its binary form. However, some libraries (quite rare) implement the %b
format code which allows to display an integer in binary form:
// Display 100 on some environments
printf ("%b", 4);
If you need to convert an integer to binary, then you will have to write a dedicated function. Depending on your needs, select one of the following options:
There is no standard function in C to convert or display an integer in its binary form. However, some libraries (quite rare) implement the %b
format code which allows to display an integer in binary form:
// Display 100 on some environments
printf ("%b", 4);
If you need to convert an integer to binary, then you will have to write a dedicated function. Depending on your needs, select one of the following options:
# | ID | Query | URL | Count |
---|