Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

global variable V.S. file variable in C++

Tags:

People also ask

Can we use global variable in another C file?

c. It's up to you how you organise your code, all you need is that after the preprocessor has finished with includes and everything else it does, file 2 has that line in it.

What is the difference between a variable and a global variable?

The main difference between Global and local variables is that global variables can be accessed globally in the entire program, whereas local variables can be accessed only within the function or block in which they are defined.

What is the difference between global and extern variable in C?

Global variable is a variable that is available throughout the program. An extern variable is also available throughout the program but extern only declares the variable but it doesn't allocate any memory for this variable.

What is a global variable in C?

The variables that are declared outside the given function are known as global variables. These do not stay limited to a specific function- which means that one can use any given function to not only access but also modify the global variables.


what is the difference between global variable and file variable in C++?

Thanks!