Initialization for Static Variables

static int i = 5;
static int j = i;

int main()
{
    return 0;
}

I initialize the static variable to another static variable declared before, but also get the variable. Please tell me why this is a mistake.

+4
source share
2 answers

j i, i. j = i, . C , . . :

static int i = 5;
static int j;

int main()
{
    j=i;    
    return 0;
}
+2

, , .

0

Source: https://habr.com/ru/post/1624665/


All Articles