The first question I ever asked on this forum!

(Long time ago, Look hier).

If a function is continous it must be a linear function thus proving your statement.

Otherwise, the axiom of choice can construct a non-linear solution

(This functional equation is one of my favorite math things I ever learned)