Primary amines can be synthesized by alkylation of ammonia. A large excess of ammonia is used if the primary amine is the desired product. Haloalkanes react with amines to give a corresponding alkyl-substituted amine, with the release of a halogen acid. Such reactions, which are most useful for alkyl iodides and bromides, are rarely employed because the degree of alkylation is difficult to control. If the reacting amine is tertiary, a quaternary ammonium cation results. Many quaternary ammonium salts can be prepared by this route with diverse R groups and many halide and pseudohalide anions.
When primary amines are heated with halogenoalkanes, a complicated series of reactions occurs, giving a mixture of products – probably one of the most confusing sets of reactions you will meet at this level. The products of the reactions include secondary and tertiary amines and their salts, and quaternary ammonium salts.