When running this program, if the value of n is set to 10 it will print the indices of array a and stored values from a[0] to a[9]. However if I set the value of n to more than 10 the then it only prints the indices of array a from a[0] to a[5] with their stored values. Can someone explain to me why this is happening?
#include <iostream>
using namespace std;
int main()
{
    int a[10];
    int i, n=11;
    for(i=0; i<n; i++) {
        a[i]= 5;
    }
    cout<<"The array is: \n";   
    for(i=0; i<n; i++)
    {
        cout<<"a["<<i<<"] = "<<a[i]<<endl;
    }
    return 0;
}
 
     
    