From 55fb1ddcd60771d556887594d637a6bb2933e43f Mon Sep 17 00:00:00 2001 From: SALONIKWATRA123 <33151263+SALONIKWATRA123@users.noreply.github.com> Date: Fri, 27 Oct 2017 18:55:59 +0530 Subject: [PATCH] Update scope.cpp Global variables are declared outside the main function & below the header file. Their value does n't disappear outside the block of the function. It persists between different function calls. --- scope.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scope.cpp b/scope.cpp index 75286c6..38725f8 100644 --- a/scope.cpp +++ b/scope.cpp @@ -3,6 +3,7 @@ using namespace std; int globalVariable; int localVariable = 25; +// Value of a global variable persists between different function calls. int main(int argc, char const *argv[]){ @@ -19,4 +20,4 @@ int main(int argc, char const *argv[]){ cout << "Value of localVariable is " << localVariable << endl; return 0; -} \ No newline at end of file +}