Typically tanks use “guns”, which are high velocity, relatively flat shooting cannons. They fire APFSDS (armor piercing fin stabilized discarding sabot), HEAT (high explosive anti tank), beehive/canister (think giant shotgun shell filled with either balls or darts) and HE (high explosive). The 120mm gun in the M1 Abrams can have a muzzle velocity in the ballpark of 5000 ft/s or 1524 m/s.
Artillery these days typically are howitzers, which are cannons designed to fire at high angles for plunging fire. They’re usually larger in bore diameter than tank guns - 155mm is a common size for NATO, and 122/152 are common Russian ones.
Anti aircraft artillery is typically either missiles or automatic cannons of 57mm or less. They might have armor piercing rounds for occasional ground use, but they’re not very penetrative.
One reason that tanks wouldn’t make good artillery is because the ammo is not at all optimized for that task. For example, a 155mm HE round is 46.7 kg, 10.8kg of which is explosive. By comparison, a 120mm HE shell fired from a tank gun is 11 kg with 3 kg of explosive.
Back during WWII, it wasn’t uncommon for guns to be adapted for various tasks- the famous German 88mm gun was originally an anti-aircraft gun, but it turned out that it had a high enough velocity to function as a fantastic anti-tank gun. Similarly, a lot of the early-war “heavy” anti-tank guns for several countries were adapted WWI/post-war antiaircraft guns, like the US 3" gun M7, which was used on the M10 tank destroyer. Interestingly enough, the M7 was an adaptation of a quick-firing coastal defense gun from 1903.
Actually that’s more along the lines of the old AP/APBC ammo from early WWII. It was basically the same design concept as naval armor piercing ammunition- a big bullet, sometimes with a “ballistic cap” of softer metal to help the round not bounce off so easily.
“Sabot” is lingo for “armor piercing discarding sabot”- basically the gun fires a smaller, lighter projectile surrounded in a larger diameter less dense “sabot” that flies off, leaving the smaller, denser projectile to continue to the target and retain more velocity. The combination of a full-sized propellant charge and a lighter projectile mean that the rounds go faster and retain that velocity better than a full-bore round. Today’s sabot rounds are APFSDS- armor piercing fin stabilized discarding sabot. Basically a 120mm round that has a roughly 1" diameter projectile with a sabot that takes up the other 95mm. It’s essentially a 1" diameter, 2’ long dart with fins that goes 5000 feet per second, and is made of depleted uranium, or in some countries, tungsten carbide or maraging steel (less effective). They’re fiendishly effective relative to older types of rounds.
HEAT is high explosive anti-tank. (see @RickJay’s post and Wikipedia article).
HESH (high explosive squash head) is an older style- it consisted of a mass of plastic explosive that would spread on impact, and then when detonated, would send a massive shock wave through the armor and cause what’s called “spalling”, where pieces of armor are propelled off the backside of the armor at very high speed. It doesn’t technically penetrate, but does destroy the crew.
HVAP is also an older style- kind of a stepping stone between AP and APFSDC- it was a smaller diameter penetrator in a larger lightweight shell- so it had higher velocity than a regular AP shell, and had higher sectional density for the smaller penetrator. But it was still a full-diameter round, so they lost velocity faster than an AP round of the same diameter, even if they started with quite a bit more. HVAP was the US Army’s most effective kinetic anti-tank round of WWII.