GIVE ANSWERS - English

100% GOOD (1 votes)Sense respostaPregunta Lingüística
How to say right? Reported speech
Could you explain me one thing. Reported speech:
 
“What is the purpose of your visit?” 
A customs officer asked me what the purpose of my visit was. 
 
Why "...asked me what the purpose of my visit was"? Should be direct order of words"...asked me what was the purpose of my visit". Or not? I'm confused :(