hello i want to assing return array from method to an array. My codes here. how can assing array to array like this?
method change codes:
int* change (int array[], int index1, int index2) {
int temp;
temp = array[index1];
array[index1] = array[index2];
array[index2] = temp;
iter++;
return array;
}
method combine's codes here:
static void combine(int mat[], int len) {
if(ok)
return;
int array[len];
*array = *mat;
if (len <= sat * sut) {
for (int i = len; i < sat * sut - 1; i++) {
for (int j = i; j < sat * sut; j++) {
// this is error row
combine(array, len + 1);
array = change(array, i, j);
if (isAcceptable(array) == "ACCEPTABLE") {
int accepted[sat*sut];
*accepted = *array;
ok = true;
return;
}
}
}
} else
return;
}
error row is here:
array = change(array, i, j);
error: [Error] incompatible types in assignment of 'int*' to 'int [(((sizetype)(((ssizetype)len) + -1)) + 1)]'
how can i fix it?
std::swapin yourchangefunction.