Iron (Fe) is a metal, gaseous hydrogen (H2) is a covalent compound and table salt (NaCl) is an ionic compound.
When atoms combine to form molecules, they tend to attain the next inert gas like electron configurations (having eight electrons, barring hydrogen which follows helium, having two electrons) in their outermost (valence) shell. This is the famous octet rule. This gives us a good way to understand type of bonding exhibited by various atoms.
Consider the formation of NaCl from the atoms. Sodium atom (Na) has the electronic configuration 2,8,1 and Chlorine (Cl) – 2,8,7. By losing the last electron Na atom is ionized to form Na+ which has the stable octet in its electronic configuration (2,8 - now). Similarly Chlorine atom (Cl) has the electronic configuration 2,8,7 and Chlorine (Cl) – 2,8,7. By gaining one electron in its outermost orbital, it is ionized to form Cl- which now has the stable octet in its electronic configuration (2,8, 8). Electrostatic force of attraction begins to operate between these two ions now that they are ionized. This is called ionic bond in NaCl. Solid crystals of NaCl are formed by a highly ordered close packing network of a huge number of alternate Na+ and Cl- ions so that one NaCl unit is inseparable from the other. As a result the intermolecular force of attraction gets magnified. That is the reason ionic compounds (like NaCl) are hard solids with high melting and boiling points. They are non conductors as there is no free electron or labile ions in solid state. They are brittle because, once the crystal structure is disturbed by mechanical (or other), the ordered network is destroyed and does not rearrange back to the original structure ordinarily.
Consider the formation of a stable homonuclear molecule like H2. Both the atoms are hydrogen with only one electron; there is no reason why one atom should lose an electron and an identical atom should gain it. The next inert gas is He, electronic configuration 2. This configuration can be attained by sharing the only electron in between them. A covalent bond is thus formed between H and H of a single hydrogen molecule. But in the intermolecular space, there is no significant force of attraction and as a result the molecule is a low boiling gas. Other similar molecules are also gases, low liquids or low melting, soft solids.
Iron metal is formed by ionic bonding between a large numbers of iron atoms. Iron (and all metals) has a type of bonding called metallic bonding. In metallic bonding the outer shells of adjacent atoms overlap, and the collection of outer shell electrons (called the electron cloud) are free to move about throughout the lattice. The metal consists of metal cations and a balancing number of these ‘free’ electrons. Iron atom has an electronic configuration of 126.96.36.199, the outer electrons are involved in the bonding in the metal. Iron is not very reactive, although it will slowly rust. Owing to the presence of free electrons, they are good conductors. Again when the metal is stressed, lattice points are dislocated to a new position, the electron cloud is capable of encircling the newer area too, thus they are ductile and malleable. Moreover, as the force of attraction through the lattice is high, the solid becomes hard, and high melting.