That means there's an x somewhere and it's an int.
The definition would look like:
int x;
That means create storage the size of an int and call that memory location x.
This allows your to write code like: header.h
1 2
externint x; // declare variable
int func(void);// declare function
worker.c
1 2 3 4 5 6
#include "header.h"
int func(void) // define function
{
return 2*x; // use x from declaration, the linker resolves the declared variable to a defined variable
}
main.c
1 2 3 4 5 6 7 8
#include "header.h"
int x; // define variable
int main()
{
return func();// use func from declaration, the linker resolves the declared function to a defined function
}
That's mostly right, except global and static variables are initialised to zero.
It's not obvious that that should be the case. But it happens to be easy for the linker to arrange. These variables with program long lifetime get placed into a segment that's zeroed in one go.