Example
Let
$$
\mathbf{Grp}
$$
be the category of groups and group homomorphisms, and
$$
\mathbf{Set}
$$
the category of sets.
Define a functor
$$
U : \mathbf{Grp} \to \mathbf{Set}
$$
as follows.
Objects
$$
U(G) = the underlying set of G.
$$
Morphisms
For a group homomorphism
$$
f : G \to H
$$
define
$$
U(f) = f
$$
viewed as a function between sets.
This functor is called the forgetful functor.