Pin is a holding device, used to lock two devices. A pin is inserted where a shaft and coupling meet so that they don't get disengaged and also the torque is transferred.
Shaft is any circular c/s element used to transfer power, mount other mechanical elements. They can be solid or hollow.
ROCKER ARM SHAFTS
GEAR CHANGE SHAFTS