When $C (X) $ is zero dimensional
I had written this as a comment, but since the discussion is now a bit confused, it is best to write it as an answer.
The completely regular spaces $X$ such that the ring $C(X)$ is zero-dimensional (i.e., every prime ideal of $C(X)$ is maximal) are known as the "P-spaces" (in the sense of Gillman and Henriksen). The book Rings of Continuous Functions by Gillman and Jerison (Springer 1960, GTM 43) describes a number of properties about them: specifically in exercise 4J and theorem 14.29 (and various other places listed after the latter theorem).
Among the equivalent properties, P-spaces are those in which every function which vanishes at a point $p\in X$ vanishes in a neighborhood of $p$, of in which every $G_\delta$ (countable intersection of open sets) is open.
These spaces look in many ways like discrete spaces, but they are not necessarily discrete: Gillman and Jerison give examples (exercises 4N and 13P) examples of nondiscrete P-spaces.
(Edit.) Here is a simple but interesting example of a non-discrete P-space: consider the set $Q$ of functions $x\colon \omega_1 \to \{0,1\}$ which are eventually $0$ (i.e. there is $\alpha<\omega_1$ such that $x(\xi)=0$ for $\xi\geq\alpha$) and order them lexicographically (i.e., $x$ and $y$ are compared as $x(\xi)$ and $y(\xi)$ for the smallest $\xi$ for which $x(\xi)\neq y(\xi)$). Put the order topoplogy on $Q$. Then $Q$ has no isolated point, but it is still a P-space (Gillman & Jerison, theorem 13.20 + exercise 13.P(1)).