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.
A global variable is accessible globally ie., it is declared outside any function and it can be accessed from any function in the program.
A local variable is accessible only in the function where it is declared ie., it is declared inside a function and can be accessed only from that function.
To access a global variable in a function, if the function has a local variable with the same name, we use the global keyword before the variable name.