forked from iot-lab-kiit/tasks.cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathq-8.cpp
More file actions
24 lines (19 loc) · 623 Bytes
/
q-8.cpp
File metadata and controls
24 lines (19 loc) · 623 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<iostream>
using namespace std;
int x=5; // Global variable
int main()
{
int x = 10; // Local variable
/*
The scope resolution operator allows us to use the Global variable
In the below example the Global variable x has value of 5 and can
be accessed using scope resolution operator.
*/
cout << "The value of the Global variable is: " << ::x <<endl;
/*
The Local variable has only the scope of the block or function in
they are declared. In this case the Local variable x has value of 10
*/
cout << "The value of the Local variable is: " << x;
return 0;
}