Declaring and defining variables

int x;

Is this a declaration or a definition?

When I write the following code,

#include <stdio.h>

int main(void)
{
    int x;
    printf("%p",&x);
    return 0;
}

he is typing some address. Since allocating memory int x;cannot be just a declaration. So is that definition?

+3
source share
2 answers

From standard C (n1256) :

6.7
...
5 . - , :

- ;
- , ; 101)
- typedef, () .

int x; ( ).

+3

int x; . extern int x; - . extern int x = 3; .

+2

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


All Articles