This is known as the water of crystallization. Water molecules are associated with salt to hydrate anhydrous salt. The water of crystallization also changes the colour of the salt. For example, Hydrated copper sulphate(CuSO4.5H20) is bright blue in colour whereas anhydrous copper sulphate(CuSO4) is white in colour.