I am busy with a project where the following function needs to be implemented in C
void logic_circuit(int inputs[4],int outputs[2])
A counter needs to be created since all the 4 bit combinations needs to be inserted into this function…
void logic_circuit(int inputs[4],int outputs[2])
{
//some calculations
outputs[0] = ...
outputs[1] = ...
}
//allocate memory
int inputs[4];
int outputs[2];
for(0000 to 1111)
{
logic_circuit(0000,outputs);
}
I have been searching the web intensively but unfortunately I was’nt able to find anything usefull.Does anyone have an idea on how to tackle this issue?
Instead of four nested loops, you could also fill the
inputsarray from a single loop counter,That scales better to larger
inputsarrays.