I have this function that generates a "3D array" (I know it's not actually a 3D array but it is a nice way to understand it for me):
int*** generate_test_arrays(int test_arrays_length, int array_values_from,
int array_values_to, int arrays_per_length) {
/*This function returns a dynamically allocated "3D array" (a pointer to it).*/
int*** test_arrays = new int**[test_arrays_length];
for (int i = 0; i < test_arrays_length; i++) {
/*printf("Group %d:n", i + 1);*/
test_arrays[i] = new int*[arrays_per_length];
for (int j = 0; j < arrays_per_length; j++) {
test_arrays[i][j] = new int[i + 1];
for (int i2 = 0; i2 < i + 1; i2++) {
test_arrays[i][j][i2] = (i2 < i) ? rand() % (array_values_to - array_values_from + 1) + array_values_from: array_values_to + 1;
/*cout << test_arrays[i][j][i2] << " ";*/
}
/*cout << endl;*/
}
/*cout << endl;*/
}
return test_arrays;
}
And I need each array of integers (i. e. each test_arrays[i][j]
) to be 16 byte aligned, but I don't know what alignment actually is and neither do I know how to align my arrays. Does anyone know? Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire