I have the following code:
int *numberArray = calloc(n, sizeof(int));
And I am unable to understand why I receive the following error.
You're using C memory re-allocation style in a C++ code.
What you want to use is new
in C++
So your code will become:
int n = 10; //n = size of your array
int *narray = new int[n];
for (int i = 0; i < n; i++)
cout << narray[i];
Alternatively you can switch back to C and use calloc with casting.
int* numberArray = (int*)calloc(n, sizeof(int));