]> git.piffa.net Git - sketchbook_andrea/blob - programming/pointers_c/pointers_function_scope_break/pointers_function_scope_break.ino
operatori + analog
[sketchbook_andrea] / programming / pointers_c / pointers_function_scope_break / pointers_function_scope_break.ino
1 int *ptr;  // no rvalue
2
3 void setup() {
4   // put your setup code here, to run once:
5   Serial.begin(9600);
6
7 }
8
9 void loop() {
10   int num =5;
11  ptr = &num ;
12  
13   transforma(num);  // Leggete i risultati con [CTR]+[SHIFT]+M
14   Serial.println(num);
15
16   Serial.flush() ;
17   exit(0); // Termina l'esecuzione
18 }
19
20 // Ignorate pure il resto del listato!
21
22 /* Transforma
23  
24  Scrive su seriale il valore della variabile a
25  trasformandolo in binario e esadecimale
26  */
27
28 void transforma(int var) {
29   Serial.print("Valore della variabile = ");
30   Serial.print(var);
31   *ptr = 12 ; // Num is outside the scope of this function
32               // but a pointer can get there
33
34
35   Serial.println();
36 }
37
38
39
40
41