system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: Why were castles/fortresses effective?

Couldn't an enemy army just march around the castle and take all of the unfortified farmland/resources? Also couldn't a castle just be sieged out until the defenders starve?
gpt
> couldn't a castle just be sieged out until the defenders starve?

Of course, that's what happened all the time. However you can have a *lot* of supplies within the castle walls and so if the invader couldn't capture the castle quickly enough they'd run out of time and resources. You'd optimally not campaign in the winter if you could avoid it, and you're not going to be able to use the enemy farmland since you're likely not going to stay in that spot for long enough. The defending population would if they are smart already have harvested whatever they could and get it in to the castle. 

Castles also could store a lot of troops, which meant that if you marched around the castle and tried to keep the campaign going suddenly you had an enemy in your back that could cut off the supply line, flank you, or work together with a different army to surround you.

Additionally castles could be used to delay the enemy while you wait for backup. If you know that there is a larger army coming but they will take two weeks to get here having a big wall to defend yourself for those two weeks until the backup could come and help you fend off the invaders was a much better strategy than not having the wall.