When the ends of the chains are joined together into a ring, cyclic compounds result; such substances often are referred to as carbocyclic or alicyclic compounds. Substitution of one or more of the ring carbon atoms in the molecules of a carbocyclic compound with a heteroatom gives a heterocyclic compound.