Salt has many uses, it can be used for flavoring, preserving and melting. There are many different kinds of salts and the one used depends on what it is needed for.
Both rock salt and canning (or pickling) salt is inexpensive, but because rock salt is not intended to be eaten it is left unrefined and is therefore cheaper.
Rock salt is used to cause the freezing point of ice to drop which draws the heat out of ice cream causing it to freeze and the ice on roads to melt. Canning salt is used mostly as a preservative especially when pickling and to add flavor.
Compared to table salt
Rock salt is unrefined so it contains many impurities. Canning salt is refined and contains no impurities and no additives, including iodine and anti-caking ingredients that are normally found in table salt, that can cause the pickles to become dark and the liquid to get cloudy.
How the salts work
Rock salt lowers the freezing point of water which causes ice to melt drawing heat from its surroundings, which causes the ice cream to freeze. Canning salt causes the microbes and bacteria to become dehydrated thus killing them.
Both rock and canning salts can be substituted with table salt. When table salt is used in place of rock salt be careful of the amount as too much table salt can cause the ice cream to freeze to fast and become "crusty". Table salt can be used in place of canning salt but the pickles won't look quite as nice, as they will be darker and the liquid will be cloudy.