C: Are scope variables available for all threads?

If I have a variable in the file outside the declared and initialized function:

static int i = 42;

Where is the variable stored i? Is this a data section ?

If I have a variable in the file outside the function, declared, but not initialized as such:

static int j;

Where is the variable stored j? Is it a BSS ?

I assume j will be initialized to zero by default, so if I then do:

j = 1;

Where will it be stored j?

Now to the part that is really interesting to me: are the variables of the static file available for all threads?

, , , , , , , .

- ?

+4
1

, : ,

, .

, , i j . A - B, B .


, aply ?

" ". , static, .

+5

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


All Articles