IPhone screen turns black when I'm calling?

When I'm calling someone, I put the phone near my ear, and the screen turns black. I thought that this was to avoid your ear from pressing anything, so you can call smoothly. Is it so?

Yes it a prox sensor that turns off the screen so your ear doesn't hang up.

Yes that is the reason, but it also saves a bit of battery with the screen turned off. When you remove your ear the screen should come back on in case you were using an automated system where you had to enter numbers during the call.

It is to conserve battery life. While the phone is up to your ear, you do not need to be able to see the screen. Once you remove it, the screen comes back on.