The oxidation potential of zinc is +0.78 V and iron is +0.44 V. Since zinc has a greater value of oxidation potential, zinc undergoes oxidation in preference to iron. That means zinc acts as an anode and makes iron to act as a cathode. Thus iron is prevented from rusting.