I am trying to understand the solution to the following question.

At which $c\in\mathbb{R}$ is the function $f:\mathbb{R}\rightarrow\mathbb{R}$ defined by $$f(x)=\begin{cases}x&\text{if $x$ is rational,}\\1-x&\text{if $x$ is irrational,}\end{cases}$$ continuous?

The solution states that the only answer is $c=1/2$, but am not sure why this is so.

I have thought about what might happen if we suppose (for a contradiction) that $f$ is continuous at some $c\neq1/2$. To arrive at a contradiction, I am trying to use the fact that $\exists$ an irrational number between any two numbers. However, I have not yet managed to arrive at a contradiction.

Could I have some suggestions as to how to progress, please?