Dear Student
Its function is to store the electrical energy and give this energy again to the circuit when necessary. In other words, it charges and discharges the electric charge stored in it. Besides this, the functions of a capacitor are as follows:
It blocks the flow of DC and permits the flow of AC.
It is used for coupling of the two sections.
It bypasses (grounds) the unwanted frequencies.
It feeds the desired signal to any section.
It is used for phase shifting.
It is also used for creating a delay in time.
It is also used for filtration,especially in removing ripples from rectified waveform.