more or less. you first initialize and do startup stuff then while SDL_QUIT event is no true you do the main loop that process variables, gets events, plays music and draws stuff each cycle. when the aplication recieves the quit signal you then shut it down. sorry for being vague, but its late and I am soooo tired... But on the whole, your code you posted is quite correct but where it says somecondition, that would be the quit event.

cheers.