So I am trying to understand it and what it is used for, I
get the difference between a declared and defined
variable.
I'll try to explain what I am confused
at using the examples in the tutorial.
Example
1:
extern int var;
int
main(void)
{
var = 10;
return
0;
}
so here
I get that you cannot assign var to 10 because no memory was allocated to
it.
Example
2:
#include
"somefile.h"
extern int var;
int
main(void)
{
var = 10;
return
0;
}
I'm
lost here. somefile.h would have something like int var = 0;to declare it correct? ut
then why would this program declare it again?
No comments:
Post a Comment