Compact operators, injectivity and closed range Let $X$ be a an infinite dimensional Banach space. $A\in B(X)$ is a compact operator. If its range $\operatorname{Im}(A)$ is closed in $X$ then $A$ cannot be injective because $A:X\to \operatorname{Im}(A)$ would be a compact bijection between Banach spaces and the unit ball $B_X=A^{-1}AB_X$ would be compact.
Now if $A$ is not injective, can we say that $\operatorname{Im}(A)$ must be closed ? Or if this is false, can we find a non injective compact operator with non closed range (i.e. infinite dimensional range) ?
 A: Consider the operator $T\colon \ell^2\to \ell^2$ defined by 
$$ T\mathbf{x}=\left(0, \frac{x_2}{2}, \frac{x_3}{3}\ldots\right).$$
$T$ is not injective because $T\mathbf{e}_1=0$, but it is compact and its range is the subspace 
$$E=\left\{\mathbf{y}\in \ell^2\ :\ y_1=0,\ (ny_n)\in \ell^2.\right\}.$$
The subspace $E$ is dense in $M=\overline{\mathrm{span}}\{\mathbf{e}_2, \mathbf{e}_3\ldots\}$, because it contains $\{\mathbf{e}_2, \mathbf{e}_3, \ldots\}$, but the inclusion $E\subset M$ is proper. For example, the sequence 
$$\mathbf{x}=\begin{cases} 
0, & n=1 \\ 
\frac{1}{n}, & n \ge 2 
\end{cases}$$
does not belong to $E$. Therefore $E$ is not closed in $M$, hence it is not closed in $\ell^2$ too.

P.S. In comments the OP requested an example in $C([0,1])$ space. This of course is more complicated because we have now left the elementary Hilbert space setting. Indeed, I am not able to furnish an example, nor I think that a natural example exists. Let me explain what natural means to me in this context. 
The typical examples of compact operators in $C([0,1])$ space are integral transforms 
$$Tf=\int_0^1 K(x, y) f(y)\, dy. $$
In turn, integral transforms usually arise as solution operators to linear boundary value problems for ODEs: 
$$\begin{cases} Lu = f, & x\in (0, 1) \\ U(u)=0\end{cases}$$ Here $L$ is a symmetric linear differential operator and $U(u)=0$ denotes the boundary conditions. (Notation is taken from Coddington-Levinson's book on ordinary differential equations, chapter 7). Now such an operator is always injective, as $Tf=0$ means that the solution to the boundary value problem is the null function $u=0$, which forces $f=Lu=L0=0$. So an example cannot come from there. 
There are also integral transforms $T$ that do not come from a boundary value problem, of course. However, the typical examples here have splitting kernel:
$$K(x, y)=\sum_{j=1}^J a_j(x)b_j(y). $$
This splitting leads to operators with finite dimensional range. So an example cannot come from there either. 
That's what I meant with natural above. But there are a lot more compact operators on $C([0, 1])$. I am sure that an example of an operator which is compact, not injective, and not finite rank can be easily crafted, perhaps with tools of abstract functional analysis (such as Schauder bases). 
A: A compact linear operator $A\colon X \to Y$, where $X$ and $Y$ are Banach spaces, has closed range if and only if it has finite rank.
Because if the range is closed, it is a Banach space, and the open mapping theorem asserts that $A(B_X)$ is a neighbourhood of $0$. But its closure is compact, so $\mathcal{R}(A)$ is locally compact. By Riesz' theorem, a Hausdorff topological vector space is locally compact if and only if it is finite-dimensional.
