Quick dynamic array question

For this small example say I make arraySize = 10 - Does that mean there are only 10 elements in the array. As in 0 to 9. Or does it mean there are 11 as in 0 - 10?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>

int main()
{
	int arraySize;
	int randomNumber = 1000;

	std::cout << "Enter the size of the array: ";
	std::cin >> arraySize;
	
	int *myArray = new int[arraySize];

	for(int i = 0; i < arraySize; i++)
	{
		myArray[i] = rand() % randomNumber;
	}
	for(int i = 0; i < arraySize; i++)
	{
		std::cout << myArray[i] << std::endl;
	}

	delete[] myArray;

	return 0;
}
Since it's a size, if the resulting array is [0..10] it would be absurd to name the variable size, wouldn't it? In C/++, if there's something that has a size (n), you can be rest assured that it's elements will be [0..n-1].
Topic archived. No new replies allowed.