Show that $K$ is closed and bounded. If any continuous function from $K(\subset \Bbb R)$ to $\Bbb R$ is uniformly continuous, then show that $K$ is closed and bounded.
Help me on this. Thanks!
 A: The result is not true.  Consider $K=\mathbb{Z} \subset \mathbb{R}$.  $\mathbb{Z}$ is discrete, so any function $f: \mathbb{Z} \to \mathbb{R}$ is continuous.
Moreover, given $\epsilon>0$, let $\delta=1/2$. Then for all $x,y\in \mathbb{Z}$ such that $|x-y|<\delta = 1/2$, we must have $x=y$, so
$$|f(x)-f(y)| = 0<\epsilon$$
In other words, $f$ is uniformly continuous.
However, $\mathbb{Z}$ is not bounded.
A: Suppose that $K$ is not closed,then $\exists $ a Cauchy sequence $x_n$ which does not converge in $K$.
Consider the set $A=\{x_n:n\in \Bbb N\}$ which is closed as it is discrete.
Define $f:A\to \Bbb N$ by $f(x_n)=n$ which is continuous hence can be extended as a function from $K$ .
Check that $f$ is not uniformly continuous.
A: As @Hayden pointed out, the implication on the boundeness of $K$ fails to be true.
Still, the implication on the closedness of $K$ holds. Let us see that

K is not closed $\Rightarrow$ there exists $f:K\to \mathbb{R}$ continuous but not uniformly continuous.

If $K$ is not closed, then there exist an accumulation point of $K$ that is not contained in $K$. Let $u$ be that point and define $f:K\to \mathbb R$ by $f(k)=(k-u)^{-1}$. Clearly, $f$ is continuous.
Let us see that $f$ is not uniformly continuous.
Fix $\varepsilon>0$ and $0<\delta<2/\varepsilon$. We must find $k,k'\in K$ such that $|k-k'|<\delta$ and $|f(k)-f(k')|\geq\varepsilon$.
Since $u$ is an accumulation point of $K$, fix $k\in K$ such that $0<|k-u|<\delta/2$, and then, fix $k'\in K$ such that $0<|k'-u|<|k-u|/2$.
We have that $k,k'\in(u-\delta/2,u+\delta/2)$, so $|k-k'|<\delta$. Moreover,
$|f(k)-f(k')| \geq |f(k')|-|f(k)|=|k'-u|^{-1}-|k-u|^{-1} > |k-u|^{-1}>\varepsilon.$
