 |
 |
 |
 |
| Name |
|
array
|
 |
|
|
| Examples |
|
// declaring an array of integers
int numbers[] = { 90, 150, 30 };
int a, b;
void setup() {
a = numbers[0] + numbers[1]; // Sets variable a to 240
b = numbers[1] + numbers[2]; // Sets variable b to 180
}
|
|
// different ways of declaring arrays of chars
char string1[15];
char string2[7] = {'h', 'e', 'l', 'l', 'o', '!'};
char string3[7] = {'h', 'e', 'l', 'l', 'o', '!', '\0'};
char string4[ ] = "hello there!";
|
|
|
| Description |
|
An array is a list of data. It is possible to have an array of any type of data. Each piece of data in an array is identified by an index number representing its position in the array. The first element in the array is [0], the second element is [1], and so on.
배열(array)는 데이터의
집합입니다. 어떤
데이터 형도 배열할수
있습니다. 각 데이터
부분은 배열의
위치표시로 참조
변호에 의하여
구별됩니다. 첫번째
요소는 [0] 가 되며
두번째는 [1] 이 됩니다.
|
 |
|
|
| Syntax |
|
datatype var[]
var[element] = value
|
 |
|
|
| Parameters |
|
| datatype
|
|
any primitive or compound datatype, including user defined classes
원시적인 또는 복합
데이터 형입니다.
사용자 정의의
클래스도 포함됩니다. |
| var
|
|
any valid variable name
변수 이름
|
| element
|
|
int: must not exceed the length of the array - 1
array-1 의 길이를 초과하지
않습니다.
|
| value
|
|
data to assign to the array element, must be the same datatype as the array
모든 요소에 지정하는
데이터이며
배열선언의 데이터
형과 같아야 합니다.
|
|
 |
|
|
| Returns |
|
|
 |
|
|
| Usage |
|
Application
|
 |
|
|
|