Hi! I've got a problem with my code. Everytime I run my program, I get an error message that I think has to do with array indexing, but I can't figure it out. This is the code that causing trouble along with the necessary info about the arrays:

If anyone could help it would be greatly appreciated. Thanks!!Code:vector<int> tempArray(s); vector<int> cowloc(c); vector<int> gaps(m-1); for(int i=0; i<s; i++) tempArray[i]=0; for(int i=0; i<c; i++) { cin >> temp; tempArray[temp-1]=1; } high=0; for(int i=0; i<s; i++) { if(tempArray[i]==1) { cowloc[high]=i+1; high++; } } min=cowloc[0]; max=cowloc[high-1]; //Rhis part is where the trouble starts for(int i=min; i<max-1; i++) { gap=0; for(int k=cowloc[i]; tempArray[k+1]==0; k++) { gap++; l=k; } for(int j=m-2; j>-1; j--) { if(gap>gaps[j]) { gaps[j]=gap; break; } } }