The purpose of adding carbon to iron is to change the properties of the iron. Carbon is a very hard substance and when it is added to iron, it becomes a much stronger material, depending on the amount of carbon added. Pure iron itself is relatively soft and ductile compared to carbon impregnated steels. By adding carbon to the iron you get a variety of strengths in your steel.
From the example of iron carbide, you may have noticed the percent carbon that is included in a specimen of iron. Iron has allotropic properties. This means it acquires a different crystal structure at different temperatures. Iron will transform to a BCC [more strength] structure or ferrite at cooling temperatures and then go to FCC [more ductile] at a lower temp also called austenite. Cementite is the name for iron carbide. It defines the point where the solubility of carbon in iron is at its maximum. This will yield a very hard and brittle steel which may not be suited for all applications.
Let's take a look at low (or mild), medium, and high carbon steels and see what conditions they are best suited for.
Medium Carbon Steels These steels will have a higher tensile strength and less ductility than mild steel. Applications for this include farm equipment, engine components, gears, and structural fixtures. Farm equipment and engine components are parts that you want to be very strong and durable yet not brittle. The medium carbon content allows the strength to be there and will hold up to many cycles of stress and strain. In an engine, the connecting rods and crankshaft endure a lot of loading and unloading. Too brittle a material could result in mechanical failures over time. And because they will be subject to high temperatures, too soft a steel will result in extreme elongation. The higher carbon content reduces elongation at high temperatures.