I'm prompting for input in the form of a binary number and i need to be able to deal with that input one bit at a time, easiest way I know of doing this is to put the data in an array.
But how? Or perhaps I'm over-thinking this problem and there's a better solution? I'm all ears.
#include <stdio.h>
#include <stdlib.h>
int main ()
{
char binary[10] = "101010101", *end;
long x = strtol(binary, &end, 2);
printf("%s in base 2 = %ld in base 10\n", binary, x);
return 0;
}