What causes an electromagnet to create a magnetic field?

A.The Earth's magnetic field.

B.The poles are attracted to each other.

C.The iron is wrapped with a coiled wire.

D.There is a current flowing through the wire.