Haloalkanes react with KCN to form alkyl cyanides as main product while with AgCN forms isocyanides as chief product. Give reason?
KCN is predominantly ionic and provides cyanide ions in solution. Although both carbon and nitrogen atoms are in a position to donate electron pairs, the attack takes place mainly through carbon atom and not through nitrogen atom since C—C bond is more stable than C—N bond. However, AgCN is mainly covalent in nature and nitrogen is free to donate electron pair forming isocyanide as the main product.