An ionic compound is formed when

A a metal bonds with another metal
B a nonmetal bonds with another nonmetal
C a metal bonds with a nonmetal
D three nonmetals bond together