Skip to content

Commit dd192aa

Browse files
Translate of array.adoc in Italian
1 parent 6248a9d commit dd192aa

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

Language/Variables/Data Types/array.adoc

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,59 +16,59 @@ subCategories: [ "Data Types" ]
1616
--
1717

1818
[float]
19-
=== Description
20-
An array is a collection of variables that are accessed with an index number. Arrays in the C programming language, on which Arduino is based, can be complicated, but using simple arrays is relatively straightforward.
19+
=== Descrizione
20+
Un array è un insieme di variabili a cui si accede con un indice. Gli array, nel linguaggio di programmazione C su cui si basa Arduino, possono essere complessi, ma l'utilizzo di semplici array è relativamente facile.
2121
[float]
22-
=== Creating (Declaring) an Array
22+
=== Creazione (Dichiarazione) di un Array
2323

24-
All of the methods below are valid ways to create (declare) an array.
24+
Tutti i metodi che seguono sono modi validi per creare (dichiarare) un array.
2525
[source,arduino]
2626
----
2727
int myInts[6];
2828
int myPins[] = {2, 4, 8, 3, 6};
2929
int mySensVals[6] = {2, 4, -8, 3, 2};
30-
char message[6] = "hello";
30+
char message[5] = "ciao";
3131
----
32-
You can declare an array without initializing it as in myInts.
32+
Puoi dichiarare un array senza inizializzarlo, come in myInts.
3333
{empty} +
34-
In myPins we declare an array without explicitly choosing a size. The compiler counts the elements and creates an array of the appropriate size.
34+
In myPins dichiariamo un array senza sceglierne esplicitamente la dimensione. Il compilatore conta gli elementi e crea un array della dimensione appropriata.
3535
{empty} +
36-
Finally you can both initialize and size your array, as in mySensVals. Note that when declaring an array of type char, one more element than your initialization is required, to hold the required null character.
36+
Infine, puoi sia inizializzare e dimensionare l'array, come in mySensVals. Nota che quando dichiari un array di tipo char, è richiesto un elemento in più rispetto all'inizializzazione, per contenere il carattere null (richiesto).
3737
[%hardbreaks]
3838

3939
[float]
40-
=== Accessing an Array
41-
Arrays are zero indexed, that is, referring to the array initialization above, the first element of the array is at index 0, hence
40+
=== Accedere a un Array
41+
Gli array hanno indice che parte da zero, cioè, in riferimento alle inizializzazioni degli array precedenti, il primo elemento dell'array è all'indice 0, perciò
4242

43-
`mySensVals[0] == 2, mySensVals[1] == 4,` and so forth.
43+
`mySensVals[0] == 2, mySensVals[1] == 4,` e così via.
4444

45-
It also means that in an array with ten elements, index nine is the last element. Hence:
45+
Significa anche che in un array con dieci elementi, l'indice nove è l'ultimo elemento. Quindi:
4646

4747
[source,arduino]
4848
----
4949
int myArray[10]={9,3,2,4,3,2,7,8,9,11};
50-
// myArray[9] contains 11
51-
// myArray[10] is invalid and contains random information (other memory address)
50+
// myArray[9] contiene 11
51+
// myArray[10] non è valido e contiene un'informazione casuale (un altro indirizzo in memoria)
5252
----
53-
For this reason you should be careful in accessing arrays. Accessing past the end of an array (using an index number greater than your declared array size - 1) is reading from memory that is in use for other purposes. Reading from these locations is probably not going to do much except yield invalid data. Writing to random memory locations is definitely a bad idea and can often lead to unhappy results such as crashes or program malfunction. This can also be a difficult bug to track down.
53+
Per questo motivo dovresti fare attenzione quando accedi agli array. Accedere oltre la fine di un array (utilizzando un indice maggiore della dimensione dell'array dichiarato - 1) significa leggere dalla memoria che viene usata per altri scopi. La lettura da queste posizioni probabilmente non servirà a molto se non per fornire dati non validi. Scrivere in posizioni di memoria casuali è sicuramente una pessima idea e spesso può portare a risultati infelici come arresti anomali o malfunzionamenti del programma. Questo può generare anche bug difficili da rintracciare.
5454
[%hardbreaks]
5555

56-
Unlike BASIC or JAVA, the C compiler does no checking to see if array access is within legal bounds of the array size that you have declared.
56+
A differenza di BASIC o JAVA, il compilatore C non controlla se l'accesso all'array rientra nei limiti della dimensione dell'array che hai dichiarato.
5757
[%hardbreaks]
5858

5959
[float]
60-
=== To assign a value to an array:
60+
=== Per assegnare un valore a un array:
6161
`mySensVals[0] = 10;`
6262
[%hardbreaks]
6363

6464
[float]
65-
=== To retrieve a value from an array:
65+
=== Per ottenere un valore da un array:
6666
`x = mySensVals[4];`
6767
[%hardbreaks]
6868

6969
[float]
70-
=== Arrays and FOR Loops
71-
Arrays are often manipulated inside for loops, where the loop counter is used as the index for each array element. For example, to print the elements of an array over the serial port, you could do something like this:
70+
=== Array e cicli FOR
71+
Gli array sono spesso manipolati all'interno di cicli for, dove il contatore è usato come indice per ciascun elemento dell'array. Per esempio, per visualizzare gli elementi di un array nella porta seriale, puoi scrivere qualcosa come:
7272

7373
[source,arduino]
7474
----
@@ -88,8 +88,8 @@ for (i = 0; i < 5; i = i + 1) {
8888
--
8989

9090
[float]
91-
=== Example Code
92-
For a complete program that demonstrates the use of arrays, see the (http://www.arduino.cc/en/Tutorial/KnightRider[Knight Rider example]) from the (http://www.arduino.cc/en/Main/LearnArduino[Tutorials]).
91+
=== Codice di esempio
92+
Per un programma completo che mostri l'uso degli array, guarda (http://www.arduino.cc/it/Tutorial/KnightRider[Knight Rider example]) nel (http://www.arduino.cc/en/Main/LearnArduino[Tutorial]).
9393

9494
--
9595
// HOW TO USE SECTION ENDS
@@ -100,7 +100,7 @@ For a complete program that demonstrates the use of arrays, see the (http://www.
100100
--
101101

102102
[float]
103-
=== See also
103+
=== Vedi anche
104104

105105
[role="language"]
106106
* #LANGUAGE# link:../../utilities/progmem[PROGMEM]

0 commit comments

Comments
 (0)