answersLogoWhite

0


Best Answer

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;

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

8y ago
  • variables are named data areas that can change during the execution of the program
  • constants are named or unnamed data areas that are prohibited from changing during the execution of the program

If named variables and constants may appear indistinguishable in the code, but will be declared differently.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are global variables explain with examples?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why there are no global variables in java?

Global variables are globally accessible. Java does not support globally accessible variables due to following reasons:The global variables breaks the referential transparencyGlobal variables creates collisions in namespac


What is the other name of global variables?

Another name of global variable is "EXTERNAL VARIABLES".


What are global variable?

Variables that are declared globally outside every program are called global variables.


What is a logical use for global variables?

Storing global data.


What are the differences between global variables and local variables in C plus plus?

Global variables can be seen in all blocks of your program, when local variables are visible only within the block where it's declared.


Can global variables be called preprocessors?

No.


Is global variables are stored in registers?

They is not.


What are the disadvantages of variables?

The only disadvantage of a global variable is that you cannot directly encapsulate them. Other than that, there is no real disadvantage of global variables.


What is the syntax of global variable in java?

There's no global variables in Java.


Are C variables initialized to 0 by default?

Only global/static variables are, local variables aren't.


whose variables are also known as global variables?

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(); }


Explain different types of variables in shell?

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