I am trying to write a program which checks if all the values in an array are equal using a for loop but I cannot figure out a way for the if statement to check if each value in the array are equal other than constantly repeating "if a[i] == a[1] && a[i] == a[0]"
and so on. I do not want to do that as i want it to work for any array of any size.
for (unsigned i = 0; i < val; i++){
if (a[i] == a[0])
return true;
else
return false;
}