I was just watching a video about how to find the mode of an array and just came across this error, this is my code
int common = 0;
int count = 0;
for ( int i=0; i<marksVal.length; i++){
int tempCommon = marksVal[i];
int tempCount = 0;
for (int p = 0; p<marksVal.length;p++);
if(marksVal[p] == tempCommon);
tempCount++;
if (tempCount > count){
common = tempCommon;
count = tempCount;
The p that can't find the symbol is the second line that has a p in it
if(marksVal[p] == tempCommon);
Is it because its in a for then if statement? I didn't think that would cause this issue. Edit: As it was pointed out to me, I made a silly mistake, I just needed to remove a ; new code looks like this:
for (int p = 0; p<marksVal.length;p++)