This is really an elementary question, but let me state it. Exercise 1.1 of the second Chapter of Hartshorne's Algebraic Geometry ask to prove that the sheaf associated to the presheaf sending every open subset of a topological space $X$ to a fixed abelian group $A$ is the sheaf of continuous functions from the open subsets of $X$ to $A$, where $A$ is equipped with the discrete topology.
I usually prove this fact in the following way. First write $\mathcal{A}$ for the presheaf sending $U\subseteq X$ non empty open subset to $A$, and $\mathcal{A^\prime}$ the sheaf sending $U$ to the set of continuous functions $f:U\rightarrow A$ where $A$ has the discrete topology. Now I define a map $\theta:\mathcal{A}(U)\rightarrow\mathcal{A^\prime}(U)$ which sends the element $a\in A$ to the constant function $\mathbf{a}:U\rightarrow A$ sending every point of $U$ to $a$. Then, if I have a map of presheaves $\phi:\mathcal{A}\rightarrow\mathcal{G}$, I argue in this way. Let me consider $f\in\mathcal{A}^\prime(U)$, and write $U=\bigsqcup_{i\in I}U_i$, where the $U_i$'s are the connected components of $U$. Then define $a_i:=f(U_i)$, which is well defined by continuity, and then define $\psi_{|U_i}:\mathcal{A}^{\prime}(U_i)\rightarrow\mathcal{G}(U_i)$ by sending $f_{|U_{i}}$ to $b_i:=\phi(a_i)$. By the sheaf property of $\mathcal{G}$, all these sections glue together to define a section $b\in\mathcal{G}(U)$. Now simply define $\psi_{|U}(f)=b$.
Now, what's wrong with this? Well, the problem is that at some point I define the morphism $\psi_{U}$ via its restriction to $U_i$. The problem is that without any hypothesis on the topological space I am considering, maybe $\mathcal{A}^\prime(U_i)$ is not even defined. In fact, if $X$ is arbitrary, nothing says that the connected components are open. Think about the situation of $\mathbb{Q}$ with the usual topology. Hence, if I assume some condition of $X$, e.g. that it is locally connected, then my proof works, but what happen if I assume that $X$ is arbitrary (as Hartshorne does)?