Which is the process by which atoms are joined to form compounds
In order to achieve the stable state (8 electrons in valence shell)
so they loss or gain or share electrons,making covalent or ionic bonds. The answer you're looking for chemical bonding