I'm looking for suggestions on how to prove that
Given a function $U: A \subset \mathbb{R}^n \to \mathbb{R}$ with $U \in C^1 $ (therefore continuous) and $A$ a connected set, $$\nabla U=\bar{0} \,\,\,\,\,\,\, \forall \bar{x} \in A\implies U=\mathrm{constant} \,\,\,\,\,\,\, \forall \bar{x} \in A$$
In particular, how is the condition of $A$ as a connected necessary?