Dynamic initialization occurs when the initialization value is unknown at compile time.
To initialise the variable, it is calculated at runtime.
Example,
int factorial(int n)
{
if ( n < 0 ) return -1; //indicates input error
else if ( n == 0 ) return 1;
else return n * factorial(n-1);
}
int const a = 10 ; //static initialization
//10 is known at compile time. Its 10!
int const b = factorial(8); //dynamic initialization
//factorial(8) isn't known at compile time,
//rather it's computed at runtime.
That is, static-initialization often includes constant-expression (which is known at compile time), whereas dynamic-initialization typically involves non-constant expression.
static int c;//this is also static initialization (with zero)!