C-programming - Global variables, C++ global variables

Global variables

Global Variable

Variables declared outside of a block are called global variables. Global variables have program scope, which means they can be accessed everywhere in the program, and they are only destroyed when the program ends.

 #include <iostream.h>
   float pi = 3.14;
   int circlearea()
   int area,r;
   area= pi*r*r;
   cout<< "area of circle: " << area << '/n';
int circlecircum()
   int circum, r;
   circum= 2*pi*r;
   cout<< " circumference of circle: " << circum << '/n';
int main( )
       return 0;


area of circle: 314
circumference of circle:62.8

The topic on C-programming - Global variables is posted by - Sathya

Hope you have enjoyed, C-programming - Global variablesThanks for your time

Tech Bluff