※スタイルシート未対応ブラウザではレイアウトを正確に再現できません。
  > | advanced by | contents  | that returns in <    
                   < [modosusu] > Color magazine monochrome light and shade   font predetermined, Gothic Ming-style type longhand   size Konaka large   standard  


  Treat two or more variables collectively.   

  1. ..clause 1..: Concept of array
  2. ..clause 2..: Array declaration
  3. ..clause 3..: Handling of array

[1] Concept of array

Whenever having declared a variable, only one had been declared up to now.
However, a large amount of variable might become necessary according to circumstances.
For instance, when you make the program that manages the point of the test of 100 people
100 variables are needed by all means.

There is no paulownia when separately 100 variables are declared.
For this case, two or more variables are declared to one degree by using the array.
The array is a mechanism handling it bringing the variable of two or more same types together.


[   Array   ]
In the declaration of two or more variables of the same type, and management by the number,
Mechanism that two or more data can be handled in bulk.
As for the variable declared as an array, each one is distinguished depending on the number.
In use suitably switching the number, 100 pieces and even 1000 pieces
It comes to be able to handle a large amount of variable similarly.

It returns to contents.


[2] Array declaration

The array is declared as follows.


型名 配列名[要素数];
The type name is the same meaning as the type of the current variable.
The variable of the type specified here is made and only the number of numbers of elements is made.

The array identifier is a name of the entire array.
Distinguish by numbering this name when an individual variable is used.

The number of elements is the numbers of made variables.
The variable of the type that specifies only the number specified here is made.
Being possible to specify it here for a number : only in the integral value.
When declaring, the variable of the integer type cannot be specified.

It is a method of the array declaration above.
The following are examples of declaring array array with 100 variables of the int type.

 
int array[100];

It returns to contents.


[3] Handling of array

If it is excluded to number the array identifier, the handling of the array is quite the same as the variable.
Do as follows to number the array identifier.


配列名[番号]
It is at the point that the number starts from the 0th that would like you to note it here.
For instance, at the array with 100 numbers of elements declared in the foregoing paragraph
The number that can be specified is 100 up to 0-99. It is not 1-100.

Though starting from the 0th might be cramped
Mathematically, the case with a convenient start from 0 is most.
I clearly understand 10 pieces ahead it because it becomes ten if ten is added to the first number.

Usual now variable and no any kooky [wari] as long as it takes care about the start from the 0th.
The following program is an example that uses the tenth element of array array.

 
#include <stdio.h> 

int main(void)  
{
	int array[100];  
	
	array[9] = 100; /* Because it is from the 0th, nine 
	is the tenth */ Printf("1:%d\n",array[9]);  
	array[9]++;  
	printf("2:%d\n",array[9]);  

	return 0;
}
The execution result of this program becomes as follows.

1:100
2:101
When the result is seen, it is understood that it is quite the same as time that used a usual variable.

It returns to contents.


< - It is advanced -> | in | head that returns  to returning  next |.