Let $X$ and $Y$ be two topological spaces with $C(X) \cong C(Y)$ (where $C(X)$ is the ring of all continuous real valued functions on $X$). I know that we can not conclude that $X$ and $Y$ are homeomorphic. But I wonder how independent $X$ and $Y$ could be ? For example is there any forced relation between their cardinality ?

Since we are talking about rings of continuous functions, I will only talk about completely regular spaces in this problem. It is well known that for completely regular spaces $X$, $C(X)\simeq C(Y)$ if and only if $\upsilon X\simeq\upsilon Y$ where $\upsilon X$ denotes the Hewittrealcompactification of a space $X$. Of course, for information on rings of continuous functions, obviously one should consult the book Rings of Continuous Functions by Gillman and Jerison. If $X$ is a completely regular space, then the Hewitt realcompactification $\upsilon X$ is defined to be the subset of the StoneCech compactification where $x\in\upsilon X$ if and only if whenever $f:X\rightarrow[0,1)$ is continuous and $\overline{f}:\beta X\rightarrow[0,1]$ is the unique continuous extension, then $f(x)<1$. Of course, since $\upsilon X\leq 2^{2^{X}}$ for all spaces $X$, if $C(X)\simeq C(Y)$, then $X\leq 2^{2^{Y}}$ and $Y\leq 2^{2^{X}}$. Assuming the existence of certain large cardinals, there are discrete spaces with $X$, $\upsilon X=2^{2^{X}}$. For example, if $\kappa$ is a strongly compact cardinal, and $X$ is a discrete space of cardinality $\kappa$, then $\upsilon X=2^{2^{X}}$, but $C(X)\simeq C(\upsilon X)$. This is because the points in $\upsilon X$ are in a onetoone correspondence with the $\sigma$complete ultrafilters on $X$ for discrete spaces $X$, and if there is a compact cardinal $\kappa$, then there are many $\sigma$complete ultrafilters on a set $X$ of cardinality $\kappa$. If $\kappa$ is a measurable cardinal, and $X=\kappa$ then $\upsilon X\geq 2^{X}$ and $C(\upsilon X)\simeq C(X)$. There are probably examples of spaces $X,Y$ of different cardinality that do not involve large cardinals where $C(X)\simeq C(Y)$, but $X\neqY$, but in order to have a discrete space as such a counterexample, one needs the existence of measurable cardinals. $\textbf{Added some time later}$ I will now give an example of a space $X$ with $X<\upsilon X$ without resorting to large cardinal hypotheses. In particular, we have $C(X)\simeq C(\upsilon X)$, but $X<\upsilon X$. Let $\mathbb{N}$ denote the natural numbers. For each unbounded function $f:\mathbb{N}\rightarrow[0,\infty)$, let $\overline{f}:\beta\mathbb{N}\rightarrow[0,\infty]$ be the unique extension of the function $f$. Then there is some point $x_{f}\in\beta\mathbb{N}$ with $\overline{f}(x_{f})=\infty$. Let $X=\mathbb{N}\cup\{x_{f}f:\mathbb{N}\rightarrow[0,\infty)\,\textrm{is unbounded}\}$. Then $X$ is a space of cardinality continuum. Furthermore, the space $X$ is pseudocompact. If $f:X\rightarrow[0,\infty)$ is continuous and unbounded, then $f_{\mathbb{N}}$ is unbounded as well, so $f(x_{f_{\mathbb{N}}})=\infty$, a contradiction. It is well known that a space $Y$ is pseudocompact if and only if $\upsilon Y=\beta Y$. Therefore, we have $\upsilon X=\beta X=\beta\mathbb{N}$. In particular, $\upsilon X=2^{2^{\aleph_{0}}}$ while $X\leq 2^{\aleph_{0}}$. 


Let $X,Y$ be arbitrary sets (of arbitrary cardinals) armed with topologies $\tau_1 = \lbrace \emptyset, X\rbrace$ and $\tau_2 = \lbrace \emptyset, Y\rbrace$. Then it is clear that $C(X) \cong \Bbb{R} \cong C(Y)$. So there is no forced relation between the cardinal numbers. 

