binary.c: An small C library to work with binary numbers
Installing using Clib
$ clib install abranhe/binary.c
#include <stdio.h> #include "binary.h" int main() { printf("%d\n", is_binary(1010)); // 1 printf("%ld\n", to_decimal(10000000011)); // 1027 printf("%lld\n", to_binary(1000)); // 1111101000 }
Returns true (1) if the number is binary, otherwise return false (0)
binary: long binary number
Returns a long decimal number from a binary number
binary: long binary number
Returns a binary number from a decimal number
decimal: a long decimal number
| Carlos Abraham Logo |
|---|
| Carlos Abraham |
MIT License © Carlos Abraham