Even as far back as WWI, tanks had already begun to specialize. The British "male" and "female" versions of its giant rhomboidal Mk.IV behemoths either mounted machineguns or small cannon as primary armament, the "female" to attack infantry and the "male" to fight enemy tanks. Saying that all WWII tanks were designed only for one or the other completely misses the point that most were intended to be multi-purpose, while a few were specialized at each of the roles. Many of them changed roles and functions as the war went on.
Examples:
The German Pz.III was intended to combat enemy armor. Its 37mm armor piercing cannon was best suited for that role, since the gun was too small in diameter to deliver effective HE rounds. The medium-length 50mm gun (L46? - ratio of length to diameter) was installed on the IIIH model when it became painfully obvious that the 37mm was inadequate against many of the French tanks, and the 50L60 quickly became the standard on models J-L after the first encounters with Soviet armor. Despite the large turret ring being designed to handle upgrades in firepower, anything heavier was beyond the limits of the engine and suspension, and the final models of PanzerKampfwagen III (M-N) were mostly built either with the same 75L24 as the original Panzer IV (the short 75mm weighed less than the long 50mm), or as flame-thrower tanks. In essence it went from a tank killer to the infantry support role.
The German PzKw.IV was intended to combat enemy infantry and fortifications. Its low-velocity 75mm howitzer was best suited for direct-fire of HE rounds, but not well suited for use against enemy armor. Later, HEAT rounds allowed it to fight against armor, and the short 75L24 gun was eventually replaced first by the L43, and then L48 medium velocity cannons, which retained most of the HE capability while giving it respectable armor piercing capability. It too lacked the horsepower and suspension to carry more weight, such as the heavier 75L70 high-velocity cannon as used on the Panther. The infantry support tank became the tank killer.