^^Linguaggio C/C++.  Domande

D: dove metti i commenti  in C ?

Indentare

la prima istruzione di una funzione e' da indentare?

 

byte addresses[][6] = {"1Node"}; // Create address for 1 pipe. *)

*) taken from: https://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-ExampleSketches

 

You have a two-dimensional array. The first (left) dimension has an unspecified number of elements. Since there is one initializer in the braces, then it has one element. So it is the same as:

byte addresses[1][6] = {"1Node"};

The other dimension is a 6-element character array. In this particular case it will hold "1Node\0" where \0 is the null-terminator (so, 5 bytes of "1Node" plus 1 byte of 0x00).

Dimension of a multidimensional array

byte a [2];
byte b [5][2];
byte c [3][5][2];

void prova ()
{
Serial.print ("Size of a = ");
Serial.print(sizeof a);
Serial.print ("/nSize of b = ");
Serial.print(sizeof b);
Serial.print ("/nSize of c = ");
Serial.print(sizeof c);
} // end prova
 

Output:

Size of a = 2
Size of b = 10
Size of c = 30

R1: That's linear! Each array is the size of the previous one multiplied by the new number of elements.

rob: in matematica si dice: multilineare.
Se consideriamo il caso:

nr elementi z= x^y,  funzione di 2 variabili.

2 casi semplici

x=cost k:  z= k^y   funzione esponenziale

y=cost k   z= x^k    funzione potenza.