When $C (X) $ is zero dimensional Let $X $ be a Tychonoff  topological (completely rgular) space and $C (X) $ be the ring of all real valued functions over $X $. When is the krull dimension of $C (X) $ zero? 
 A: 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)).
A: (Edited, see comments and Gro-Tsen's answer)  
Put $A=C(X)$. 

(Wrong) I claim that $\dim A=0$ if and only if $X$ is discrete.  

The "if" part is easy. Conversely, the condition $\dim A=0$ implies (without any other assumption on $X$) that every $f\in A$ is locally constant. Indeed, fix $f\in A$ and  $x\in X$. Denote by $m\subset A$ the corresponding maximal ideal. Then $A_m$ is a reduced zero-dimensional local ring, hence coincides with its residue field $\mathbb{R}$. In particular, the image of $f-f(x)$ in $A_m$ is zero, so $f=f(x)$ in a neighborhood of $x$.  

(Wrong) Now if in addition $X$ is a Tychonoff space, every point is the zero set of some $f\in A$, hence must be isolated.

