]> git.piffa.net Git - arduino/blob - books/beginning_c_code/Chapter07/Listing7_1/Listing7_1.ino
first commit
[arduino] / books / beginning_c_code / Chapter07 / Listing7_1 / Listing7_1.ino
1 /**
2   Program: Demonstrate the concept of local scope
3   
4   Author: Dr. Purdum, Aug. 9, 2012
5 **/
6 #define MAXVAL 1000
7
8 int k = 0;
9
10 void setup()
11 {
12   Serial.begin(9600);
13 }
14
15
16 void loop()
17 {
18   int x = 5;
19   
20   if (x < MAXVAL) {
21    int temp;
22
23    temp = x * 100;
24   }
25   Serial.print("The value of temp is: ");
26   Serial.println(temp);
27   if (k++ > 10)
28      exit(0);
29 }
30 \r