vendredi 2 septembre 2016

Is there a printf converter to print in binary format?

I can print with printf as a hex or octal number. Is there a format tag to print as binary, or arbitrary base?

I am running gcc.

printf("%d %x %on", 10, 10, 10); //prints "10 A 12n"
print("%bn", 10); // prints "%bn"

Aucun commentaire:

Enregistrer un commentaire