A transistor is a semiconductor device used for amplifying, controlling and generating electrical signals. It controls the movement of electrons and thereby controls the electrical power. They are widely used on electronic appliances such as radios, calculators, and computers.
p-n-p semiconductor: Thin layer of lightly doped n-type semiconductor is sandwiched between heavily doped p-type semiconductors to form p-n-p transistor.
n-p-n semiconductor: Thin layer of lightly doped p-type semiconductor is sandwiched between heavily doped n-type semiconductors to form n-p-n transistor.
Emitter is heavily doped and supplies majority carriers for transistor function, Collector moderately doped and collects the charged carriers emitted by the emitter, and the Base serves as a gate and regulate the flow of charge from emitter to collector
Images source and for detail: learnfresh.blogspot.com.au
Transistor has three terminals known as Emitter, Collector and Base for external circuits.
Transistors not only allow the current to flow, but also control the amount of current flow through them. They can act as a switch or an amplifier and control the current flow through a circuit board with precision.