//creating global variable
int summation = 0;
int local_addition(int a, int b){
//creating a local variable
int sum = a + b;
return sum;
}
void global_addition(int a, int b){
//accessing the global variable
summation = a + b;
}
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
summation = local_addition(9,4);
Serial.print("Local summation:");
Serial.println(summation);
delay(1000);
global_addition(8, 9);
Serial.print("Global summation:");
Serial.println(summation);
}
void loop() {
// put your main code here, to run repeatedly:
// infinite while loop to stop printing again and again.
//while (true){
//}
}