I know how to prove that a continuous function like f:[a,b]→[a,b] has a fixed point, but I don't know how to distinguish intervals in this question.
Then Make an interval.
Let $x_0$ be any point. If $f(x_0) =x_0$ we can let $c = x_0$ and we are done.
If $x_0 < f(x_0)$ let $a = x_0$ and $b = f(x_0)$. In this case you have i) $a < b$ and ii) $f(a) = b$. And iii) $f(b) = f(f(a)) = a$.
If $x_0 > f(x_0)$ then let $a=f(x_0)$ and let $b =x_0$. Again in this case you have i)$a < b$ and ii) $f(a) = f(f(b))=b$ and ii) $f(b) = a$.
and thus you know that $f$ is continuous on $[a,b]$ and that $f(a) = b$ and $f(b) = a$ and .... now go to town.
....
Let $g(x)=f(x) -x$ which is continuous. $g(a) = f(a) - a = b-a >0$ and $g(b) = f(b) - b=a-b < 0$ so there is a $c: a < c < b$ so that $g(c) = 0$ so $f(c) - c = 0$ and $f(c) = c$.