Hi,
I am little bit confused I don't understand difference between global variable and static variable that declare outside function.
Code:
#include<stdio.h>
int X = 10; //Global variable
static int Y = 100; // static variable
int main ()
{
while (1)
{
return 0;
}
}
Both X and Y variable are only accessible within source file
Both X and Y variable only alive until program exit
I don't understand difference between global variable and static variable that declare outside function.
Is there any difference between them in standard c ?
Are they same or different?