The walls surrounding a castle occasionally with towers is the curtain wall. Designed with battlements to defend the walls against attack. Such as merlons, embrasures, and loopholes.
A merlon is an upright wall protecting a walkway at the top of the walls. With openings between two merlons called a crenel or embrasure.
A slot cut into a battlement allowing for an archer to launch arrows is called a loophole, or arrowslit.