Hint: Ionic bonding is a type of chemical bonding in which ionic bonds are formed only between a cation and an anion with sufficient electronegative attraction between them.
Complete step by step answer: -Ionic compounds are formed between a cation and an anion. A cation is an electropositive ion and prefers to lose the valence electrons. Similarly, anions are electronegative ions and prefer to gain electrons. The electro positivity or electronegativity of any ion can be determined by the electronic configuration of the elements. -Iodine and bromine both have valence electronic configuration of $np^5$ . This means that both would act as a cation and would only accept electrons while forming an ionic bond. Hence both cannot form an ionic bond with each other. -Hydrogen is electropositive while iodine is electronegative. But the electronegativity differences are not enough to form an ionic bond. Hence hydrogen and iodine form a covalent bond. -Potassium is a cation and iodine is an anion. The electronegativity difference between the two of them is substantial and results in the transfer of electrons and formation of ions. Hence these potassium and iodine form an ionic bond.
Hence, Option C is the correct option.
Note: Always consider the electronegativity difference to understand the nature of the bond. Carbon can form only covalent bonds. Carbon cannot form ionic bonds because in order to form an ionic bond carbon needs to lose or gain 4 electrons which is not possible.