Two procedures that should give identical results.
However the the second one does not work,gives unexpected results.
//Module data
bool bitdata[30];
char digdata[10];
int bitNr;
int digNr;
//Convert bitdata into digdata
void make_digdata(){
bitNr=0;
for (digNr = 0;digNr < 7;digNr++)
{
digdata[digNr] = (bitdata[bitNr+0] * 8) + (bitdata[bitNr+1] * 4) + (bitdata[bitNr+2] * 2) + (bitdata[bitNr+3]);
bitNr += 4;
}
}
//Module data
bool bitdata[30];
char digdata[10];
int bitNr;
int digNr;
//Convert bitdata into digdata
void make_digdata1(){
bitNr=0;
for (digNr = 0;digNr < 7;digNr++)
{
digdata[digNr] = (bitdata[bitNr++] * 8) + (bitdata[bitNr++] * 4) + (bitdata[bitNr++] * 2) + (bitdata[bitNr++]);
}
}
I thought that bitNr was used as index first and than evaluated (incremented)
Two procedures that should give identical results.
However the the second one does not work,gives unexpected results.
I thought that bitNr was used as index first and than evaluated (incremented)