+2 votes
in Class 12 by kratos

What do you understand by local and global scope of variables? How can you access a global variable inside the function, if function has a variable with same name.

1 Answer

+2 votes
by kratos
 
Best answer

A global variable is a variable that is accessible globally. A local variable is one that is only accessible to the current scope, such as temporary variables used in a single function definition.

A variable declared outside of the function or in global scope is known as global variable. This means, global variable can be accessed inside or outside of the function where as local variable can be used only inside of the function. We can access by declaring variable as global A

...