initialize all elements of array to 1 c++ code example
Example 1: c++ initialize array 1 to n
std::vector<int> arr(SIZE);
for (int i = 0; i < SIZE; i++)
{
arr[i] = i;
}
Example 2: initialize whole array to 0 c++
int nScores[100] = {0};
std::vector<int> arr(SIZE);
for (int i = 0; i < SIZE; i++)
{
arr[i] = i;
}
int nScores[100] = {0};