Accessing the Value of the Global Variable

In this lesson, you will see how to access the value of global variables in a program.

Introduction

We know that we can access the value of local variables any number of times in a program. Similarly, we can also access the value of global variables in a function.

Example program

Run the program below and see the output!

Get hands-on with 1400+ tech skills courses.