2 Purpose: Illustrate pointer arithmetic
3 Dr. Purdum, August 20, 2012
15 strcpy(buffer, "When in the course of human events");
17 length = strlen(buffer);
18 Serial.print("The lvalue for ptr is: ");
19 Serial.print((unsigned int)&ptr);
20 Serial.print(" and the rvalue is ");
21 Serial.println((unsigned int)ptr);
23 Serial.print(*ptr++); // This actually incrementa ptr* + 34
27 Serial.println("Lenght of the string is: ");
28 Serial.println(length);
32 // ptr = ptr - length ; // Whis would roll back ptr
33 for (i = 0; i < length; i++) {
34 Serial.print(*(ptr + i));
35 // Serial.print(*(ptr + i- lenght)); // ptr is one lenght up ahead
37 // ptr = buffer ; // Right thing to do: reset the pointer before use
38 // for (i = 0; i < length; i++) {
39 // Serial.print(*(ptr + i))
43 // Make sure all the data is sent...