Let $f:M\to N$, show that if $K\subset M$, $K$ is a compact subset of $M$, and if $f\vert_{K}\in\mathcal{C}(K,N)$, then $f\in\mathcal{C}(M,N)$.
My approach: If $f\vert_{K}$ on the space of continuous functions $\mathcal{C}(K,N)$, such that $f\vert_{K}:K\to N$, with $f\vert_{K}=f\circ id$, where $id:K\to M$ and $id(x)=x$ for all $x\in K$. Then, if $f\vert_{K}$ is continuos, also is $f\circ id$, therefore $f$ is continuos. This is right?? regards!