]> git.piffa.net Git - arduino/blob - books/beginning_c_code/Chapter10/Listing10_1/Listing10_1.ino
first commit
[arduino] / books / beginning_c_code / Chapter10 / Listing10_1 / Listing10_1.ino
1 /* 
2   Purpose: To show the use of the dot operator
3   Dr. Purdum, Aug. 25, 2012
4 */
5
6
7 struct servicePeople {
8   int ID;
9   char Name[20];
10   char PW[10];
11   long Phone;
12 } myServicePeople, yourServicePeople;
13 void setup() {
14   Serial.begin(9600);
15   Serial.print("myServicePeople lvalue: ");
16   Serial.print((int) &myServicePeople);
17   Serial.print("  yourServicePeople lvalue: ");
18   Serial.println((int) &yourServicePeople);
19   yourServicePeople.ID = 205;
20   Serial.print("myServicePeople.ID rvalue: ");
21   Serial.print(myServicePeople.ID);
22   Serial.print("  yourServicePeople.ID rvalue: ");
23   Serial.println(yourServicePeople.ID);
24   myServicePeople = yourServicePeople;
25   Serial.println("After assignment:");
26   Serial.print("myServicePeople.ID rvalue: ");
27   Serial.print(myServicePeople.ID);
28   Serial.print("  yourServicePeople.ID rvalue: ");
29   Serial.println(yourServicePeople.ID);
30   Serial.print("A servicePerson structure takes ");
31   Serial.print(sizeof(servicePeople));
32   Serial.println(" bytes of storage.");
33
34
35 void loop(){
36
37 }
38 \r