Well… I’m going to be cheeky and point you to an answer to this question, in a post we’ve just written for UK Solar Physics’ Nugget series.
Incidentally, if you’re interested in how the Sun works, I’d really recommend visiting their archive of bite-sized insights.