-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eeac979
commit 69ba956
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int globalvariable=20; //global variable | ||
void add() | ||
{ | ||
//local variable | ||
int Locavariable=30; | ||
cout<<"The value of the local variable is: "<<Locavariable<<endl; | ||
cout<<"Hellow world"<<endl; | ||
cout<<"The value of global variable is: "<<globalvariable<<endl; | ||
for (int i=1;i<=10;i++) | ||
{ | ||
|
||
} | ||
// cout<<i<<endl; //Loop variable cant be acces outside the loop... | ||
} | ||
void average(int x,int y) //the paramter inside void average function are formal.. | ||
{ | ||
int result=(x+y)/2; | ||
cout<<"The value of the average is:"<<result<<endl; | ||
} | ||
int main() | ||
{ | ||
//but when i will acess the local variable outside function it will genrate error for me.. | ||
add(); | ||
// cout<<localvariable<<endl; | ||
//formal paramter and acutsl paramter | ||
int x=20; | ||
int y=40; | ||
average(x,y); //actual paramter ehich is pass through average | ||
|
||
} |