1. He said to me,"Where do you live?"

2. He asked me where I lived.

3. He said, "Where is the key?"
4. He asked where the key was.
(Is #4 grammatical?)

2 answers

1. He asked me,"Where do you live?"
2. He asked me where I lived.

3. He asked, "Where is the key?"
4. He asked where the key was.

[Yes, #4 is fine.]
Thank you for your help.

1. He said to me,"Where do you live?"

(is this expressions wrong?)