Hello everyone ,
I’m working with a multidimensional array [4][8] FourRowsEightColums and I have been trying to copy all values array to another array[4][8] with the exactly the same structure FourRowsEightColums.
char ArrayA[4][8] ={
{'H','-','L','-','H','-','L','-'},
{'-','H','-','L','-','H','-','L'},
{'H','-','L','-','H','-','L','-'},
{'-','H','-','L','-','H','-','L'}};
char AssyB[4][8] ={
{'L','-','H','-','L','-','H','-'},
{'-','L','-','H','-','L','-','H'},
{'L','-','H','-','L','-','H','-'},
{'-','L','-','H','-','L','-','H'}};
char AssyC[4][8] ={
{'-','H','-','L','-','H','-','L'},
{'L','-','H','-','L','-','H','-'},
{'-','H','-','L','-','H','-','L'},
{'L','-','H','-','L','-','H','-'}};
char ArraySelected[4][8];
caar ArrayRead[4][8];
I have created a function to compare a values read array from Hall-Sensors-Magnetics vs to ArrayA, B and C but I need copy the array A, B or C depending of the first value to ArrayRead to after compare with ArraySelected and not repit FORs into IFs.
bool CompareResults(){
bool Good;
if(AssyReader[0][0] == 'L'){
ArraySelected = AssyA;
} else if(AssyReader[0][0] == 'H'){
ArraySelected = AssyB;
} else (AssyReader[0][0] == '-'){
ArraySelected = AssyC;
}
for(int j=0;j<=3;j++){
for(int i=0;i<=7;i++){
if(AssyReader[j][i]== AssySlected[j][i]){
Good = true;
} else {
Good = false;
break;
}
}
}
return Good;
}
I have errors "invalid array assugment" to copy the Array A, b and C to ArraySelected.
Does anyone know how I can solve this without introducing the FORs inside each IF..