An element of a ring R is called clean if it is the sum of a unit and an idempotent and a subset A of R is called clean if every element of A is clean. A topological characterization of clean elements of C(X) is given and it is shown that C(X) is clean if and only if X is strongly zero-dimensional, if and only if there exists a clean prime ideal in C(X). We will also characterize topological spaces X for which the ideal C_{K}(X) is clean. Whenever X is locally compact, it is shown that C_{K}(X) is clean if and only if X is zero-dimensional.