Suppose, for generality:
const int N = 500;
a = new char[N];
char b[N];
You access bit
bitno
of either
a
or
b
in the same way (note: not tested):
int getbit(int bitno, int x[], int size)
{
if ( bitno < 0 || bitno >= (size*8) )
{
}
int byte, b;
byte = bitno / 8;
b = bitno % 8
return (x[byte] >> b) & 0x01;
}