I see your point, a backspace would cause an error in my code, but the concept behind it is still the [imho] best way to get binary numbers. Try
Again, just do that twice, and add the two totals.Code:char bits[31]; unsigned int total = 0; int index = 0; scanf("%s", bits); do { if(int(bits[index]) - int('0') <= 1) { total = (total * 2) + (int(bits[index]) - int('0')) } index++; } while(index <= 31)