]> git.piffa.net Git - arduino/blob - books/beginning_c_code/Chapter08/Listing8_1/Listing8_1.ino
first commit
[arduino] / books / beginning_c_code / Chapter08 / Listing8_1 / Listing8_1.ino
1 /*
2   Purpose: Simple program to demonstrate using a pointer
3   
4   Dr. Purdum, August 13, 2012
5  */
6 #include <stdio.h>
7 int counter = 0;
8 void setup() {                
9   // So we can communicate with the PC
10   Serial.begin(9600);   
11 }
12
13
14 void loop() {
15   int number = 5;
16   int *ptrNumber;
17
18   Serial.print("The lvalue for ptrNumber is: ");  
19   Serial.print((long) &ptrNumber, DEC);
20   Serial.print(" and the rvalue is ");
21   Serial.println((long) ptrNumber, DEC);
22
23   //=== Put new statements here!
24   Serial.print("The lvalue for number is: ");  
25   Serial.print((long) &number, DEC);
26   Serial.print(" and has an rvalue of ");
27   Serial.println((int) number, DEC);
28   counter++;
29   if (counter > 10) {
30     Serial.flush();
31     exit(0);
32   }
33 }
34 \r