This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Global Variable.

In my project I have two files. as follows

File A
int x;
main()
{
x=2;
}

File B

extern int x;
{
x=4;
}

When I compile both files independatly, there is no error. When I link both modules, there is no error. But when I execute this program, I am unable to assign x = 4. Always the value of x remains 2. But in file A I can assign any value to x. Why I can not assign any value to x in File B? I am trying this with Keil compiler.

0