By hypothesis, $f(c)-f(a)$ and $f(b)-f(c)$ must have different signs. So either
1) $f(c)>f(a)$ and $f(b)<f(c)$.
or
2) $f(c)<f(a)$ and $f(b)>f(c)$.
Suppose case 1) holds. Choose any number $r\ne f(c)$ between $f(c)$ and $\max\{f(a),f(b)\}$.
Then on the interval $[a,c]$, we have $f(a)\le r< f(c)$. By the Intermediate Value Theorem, there is a point $d$ in $[a,c]$ with $f(d)=r$. Since $r\ne f(c)$, it follows that $d\in [a,c)$.
On the interval $[c,b]$, we have $f(b)\le r<f(c)$. By the Intermediate Value Theorem, there is a point $e$ in $[c,b]$ with $f(e)=r$. Since $r\ne f(c)$, it follows that $e\in (c,b]$.
Thus we have points $d\ne e$ in $[a,b]$ with $f(d)=f(e)$.
The Mean Value Theorem then gives a point $h\in(a,b)$ with
$$f'(h)=
{f(e)-f(d)\over e-d}=
0.$$
I'll leave case 2) for you.
In Case 1:

the graph of $f$ intersects the line $y=r$ in each of the intervals $[a,c)$ and $(c,b]$.