thanks to all.
Please tell me how does it works when voltage varies from high to low?
as per my understanding when voltage becomes low, charged capacitor will discharge some energy but what happens when voltage becomes high?
Theoretically the circuit in which the Capacitor is in series with opens up, and the Voltage maxes at the input or dynamic voltage input level.
Then the circuit that it is in parallel with uses it for the voltage source when the dynamic voltage driving the circuit drops... thereby stabilizing fluctuations in the dynamically generative voltage input into the overall circuit as the now under driven circuit output load drains back down the voltage that has been stored across the capacitor [opening back up 'its' circuit].
So the Capacitor works as a short in the circuit initially, with no voltage across it. and then exponentially building up, the current trickles to a stop as the voltage across it acheives the voltage that is dynamically driving the circuit or the in effect voltage source.
And then it is drained off, causing the voltage source driving the circuit to be greater now than the voltage across the draining capacitor and drive more current into its circuit until there is no potential difference again between the driving voltage and the stored voltage across the capacitive plates.... kind of like a slinky going down the steps that builds dynamic energy into potential energy as it falls down the step and then due to the potential energy of the step it following momentum takes another step down.
Except there is no step down, there is just a draining down of energy and then a restoring again of potential.
That is why capacitance in a circuit [as well as inductance] is called 'reactance'. It reacts with the voltage source. It doesn't 'resist' it [doesn't consume energy]. And it doesn't create or generate voltage in the circuit, but the dimensional elements which through 'reacting' with the voltage in the circuit stores it until it is needed to maintain the voltage level.
Unlike resistive elements where voltage and current occur coincident in time and so consume 'power' [the fox consumes the rabbit],
the reactive elements cause the voltage and current to separate in time. The current [in case of a capacitor] jumps ahead in time,
and inductive reactance causes the current changes in the circuit to lag behind in time...,
so that the feared fox doesn't find the rabbit... doesn't consume the running rabbit out of existence.
...as the capacitor resists changes in voltage; and the inductor resists changes in current.
Alternatively the capacitance storing voltage in the circuit can become a problem to be overcome with shunts or shorts perhaps through resistors to ground to get rid of it.