What is the scope of a Variable? Explain the difference between a global and local variables with example programs.
What is the scope of a Variable? Explain the difference between global and local variables with example programs. A scope in any programming is a region of the program where a defined variable can have its existence and beyond that variable, it cannot be accessed. There are three places where variables can be declared in C programming language − Inside a function or a block which is called local variables. Outside of all functions which are called global variables. In the definition of function parameters which are called formal parameters. Let us understand what are local and global variables, and formal parameters. Local Variables Variables that are declared inside a function or block are called local variables. They can be used only by statements that are inside that function or block of code. Local variables are not known to functions outside their own. The following example shows how local variables are u...