TITLE: Which sets occur as boundaries of other sets in topological spaces?
QUESTION [24 upvotes]: This question was originally asked on MathStackExchange and is migrated here with opinion from MO meta. I am integrating the inputs from users Daniel Fischer and Emil Jerabek there into this post.
Which sets occur as boundaries of other sets in topological spaces?
Of course the boundary of a set is closed. But not every closed set in a topological space is the boundary of some set in that space; only the empty set occurs as a boundary in a discrete space.
More generally, boundaries cannot contain isolated points of the ambient space (but can well have isolated points of itself).
It is tempting to assert that boundaries have empty interiors, but this is not true, as is shown by the fact that the boundary of Q in R is R. In fact it can be seen in general that the boundary of a dense set with empty interior is the whole space. Thus the only boundary in an indiscrete space is the whole set, just as the only boundary in a discrete space is the empty set.
However the intuitive feeling comes right for open sets (and then for closed sets as well): The boundary of an open set cannot contain an open set.
This question concerns all subsets of a topological space.
An alternative/related question shall be to characterise all topological spaces in which every closed set occurs as a boundary.
Being a perfect space (i.e., one without isolated points) is a necessary condition, as a previous remark above about isolated points shows.
Emil Jerabek has conjectured on meta that this (being perfect) is sufficient too, for $T_0$ second countable spaces.

REPLY [13 votes]: Building on Joseph Van Name's answer
A closed set is a boundary if and only if its interior is a resolvable topological space
Proof: 
$\leftarrow$ If $A$ is a subset of $X$ whose interior $A^o$ is resolvable, i.e., $A^o=B\cup (A^o-B)$ where $B$ and $A^o-B$ are dense in $A^o$, let $C$ be the union of the complement of the set and one of the two dense parts of the interior,
$C=B\cup A^c$.
The interior of this union is just the complement of the set,
$C^o=(B\cup A^c)^o=A^c$,
as $B$ cannot contain interior points if $A^o-B$ has to be dense in $A^o$.
The closure of this union, $\overline{C}=\overline{B\cup A^c} $ includes the interior $A^o$ and the complement $A^c$ of $A$, and is closed, so is the whole space, i.e., $\overline{C}=X$. 
Hence, $\partial C=\overline{C}-C^o=X-A^c=A.$
$\rightarrow$ For this part, note that the property of a set being a boundary is preserved by restriction to open subsets, and use Joesph Van Name's answer.