What was the primary purpose of the Great Wall?

A. Collect taxes efficiently
B. Show off China's engineering to the world
C. Protect China from foreign invasion
D. Keep Chinese citizens from leaving