In the fourth edition of "Introduction to Real Analysis" by Bartle and Sherbert, theorem 6.2.3 (Rolle's theorem) states,
Suppose that f is continuous on a closed interval $I := [a, b]$, that the derivative of $f$ exists at every point of the open interval $(a, b)$, and that $f(a) = f(b) = 0$. Then there exists at least one point $c$ in $(a, b)$ such that the derivative of $f$ is zero at $c$.
Now, why are we taking $f(a)=0=f(b)$? Is $f(a)=f(b)$ not sufficient?