so i have this function that returns a binary representation in c:
long int int2bin(int d)
{
int rem, pow = 1;
long int b = 0;
while(d > 0)
{
rem = d % 2 ;
b += (pow * rem);
d /= 2;
pow *= 10;
}
return b;
}
so from this i was wondering how i might go about having a bin2int() function:
long int bin2int( bin b);
and you would use it like this:
bin2int(10011);
and i could this
printf("%i\n", bin2int(10011));
to get 19