I\'m coding in C++, and I have the following code:
int array[30]; array[9] = 1; array[5] = 1; array[14] = 1; array[8] = 2; array[15] = 2; array[23] = 2; array[1
This function will help make it less painful.
void initialize(int * arr, std::initializer_list list, int value) { for (auto i : list) { arr[i] = value; } }
Call it like this.
initialize(array,{9,5,14},2);