Variables that the program can use everywhere in the program. Example:
int x = 5;
int main(void)
{
x = 6;
foo();
return 0;
}
void foo(void)
{
x = 5;
}
Chat with our AI personalities
If named variables and constants may appear indistinguishable in the code, but will be declared differently.
Storing global data.
Only global/static variables are, local variables aren't.
Environment Variables: Sometimes called special shell variables, keyword variables, predefined shell variables, or standard shell variables, they are used to tailor the operating environment to suit your needs. Examples include PATH, TERM, HOME, and MAIL.User-defined Variables: These are variables that you create yourself.Positional Parameters: These are used by the shell to store the values of command-line arguments
The variables which are declared outside the main() function is known as global variables and they can be used anywhere in the program. And, the variables which used declare inside the main() function is known as local variables and they can be used inside the main() function only. Example: #include<stdio.h> #include<conio.h> int x,y; // global variables void main() { int a,b; // Local variables ------------ ---------------------- --------------------- getch(); }
Global Variables Or: variables with names longer than 128 characters.