What is function of piston pin of a piston?

The piston pin joins the piston to the connecting rod. Igniting fuel / air mixture pushes down on the top of the piston, the piston transfers the force to the connecting rod, which in turn pushes against the crankshaft, converting the up and down motion of the piston to the rotary motion of the crankshaft.

The piston pin allows back and forth motion of the connecting rod (as it's other end is moving back and forth in a circular motion with the crankshaft.)...if instead of a pin a solid joint was made from the piston to the connecting rod the engine would not be able to run, as the connecting rod would try to rock the piston back and forth (side to side, not up and down) as the rod was moved sideways with the crankshaft.