Compiler Error C2093

'variable1' : cannot be initialized using address of automatic variable 'variable2'

The program tried to use the address of an automatic variable in the initializer of a static item, as in the following example:

func()
{
    int i;
    static int *ip=&i;    // error
}