Edinburgh Castle sits atop Castle Rock, a volcanic plug rising 122 metres (400 feet) above sea level — not "feet high" as a structure, but elevation.
Castle Rock is a dolerite volcanic plug — erosion-resistant core of a 340-million-year-old volcano. Glaciers carved surrounding softer sedimentary rock, leaving the plug as a crag-and-tail formation (Royal Mile = tail).
Strategic elevation: defensible, visible, commanding Forth approaches. Human occupation since Iron Age (900 BCE). The height is the castle's reason for existence.