1. ## Corrupted variable stack?

Greetings again! I am getting corrupted stack variable for this piece of bolded code. (starCounter is corrupted) I've searched and couldn't find the solution.

Code:
```int i;
int j;
int s;

double starCounter[18]= {0};
double lowestfreq = 0;
double frequencyChecker [18] = {0};
int begin = 2005;
int end = 2010;

// looking for the highest possible value in perHundredThousand
for(s=0;s<18;s++){
frequencyChecker[s] = perHundredThousand[s];
if(frequencyChecker[s]>lowestfreq){
lowestfreq = frequencyChecker[s];
}
}
// looking for the lowest possible value in perHundredThousand
for(s=0;s<18;s++){
frequencyChecker[s] = perHundredThousand[s];
if (frequencyChecker[s]<lowestfreq){
lowestfreq = frequencyChecker[s];
}
}

if(lowestfreq > 0.01){

printf("\t\t\tGraph\t\t\n");
printf("==========================================================\n");
for(i=18; i>0; --i){
starCounter[i]=ceil(perHundredThousand[i]/lowestfreq);
if (starCounter[i] > 65){
for(s = 18; s>0; --s){
starCounter[s] = ceil(starCounter[s]/2);
}
}
printf("%d - %d |", begin, end);
for(j=0;j<starCounter[j];j++){
printf("*");

}
printf("\n");
begin = end - 10;
end = end - 5;
}
}

else{
printf("No frequency greater than 0.01");
}

}```

2. starCounter is an array of 18 elements. Valid indices are 0 to 17. Your bolded code is modifying starCounter[1] through starCounter[18]. starCounter[18] does not exist.

3. Ok I fixed that problem but now my chart wont print. I think I made a mistake again on one of the for loops that are commented. The first one looks for the biggest value in the perHundredThousand array, and the second one looks for the smallest value in the same array. Am I doing both correctly?

4. Do you want the variable lowestFreq to hold the biggest value or the smallest value? It can't hold both at once.

5. oh, the plan was to initialize it as the biggest value, then find the lowest value based on the found highest.