During the formation of ionic compounds positive and negative ions are formed from neutral atoms and then these oppositely charged ions are held in a crystal lattice.
So the necessary conditions for the formation of a bond are:
(i) Formed between a metal and a nonmetal atom. A covalent bond is formed between two non-metals. An ionic bond is defined as the bond formed due to the transfer of one or more electrons from one atom to another. An ionic bond is always formed between a metal and a non-metal.
(ii) Low ionization potential and low electronegative value of the first element. The difference in electronegativity between the combining atoms of the two non-metals must be sufficiently low. So, more easily a metal is able to lose an electron more easily it will form a cation. Therefore, low is the ionization energy more readily the metal will form a cation.
(iii) High Electron affinity of 2nd element. The two combining atoms should have a high electron affinity.
(iv) The high Lattice energy of the compound formed. The two combining atoms should have high ionization energy. High lattice enthalpy of the ionic compound formed. More negative electron gain enthalpy of an element forming anion.
Each of the two combing atoms should have 5, 6 or 7 electrons in their valence shells or the outermost shells. In such cases, both the atoms achieve the stable octet by sharing 3,2 or 1 electron pair respectively. Similarly, more is the ability of a non-metal to attract the electrons towards itself more easily it will form an anion. Hence, non-metal should be of high electronegativity.
Hence, the ionic bond is formed between Na and CI atoms.