/** Array: A collection of data used to hold a set of data * * * before you create an array you need to be aware of what type of data the array needs to store * How many data are stored in the array * * Common array notation * data type [] array name =new data type [number of data to be stored in array]; * * For example: int[] arr=new int[3]; * * * A. int[] is a 1 data type. read as an int array. * B. arr is a 1 variable. The type of this variable is an int array type. * C. New int[3]; This is an expression of 1. The result of this expression is the value of the ARR variable.; * * * */ int[] arr =New int[3]; /** 12. Initializer for an array: assigns a value to the elements of an array while declaring it. * Write the values of the elements in the braces and separate them with commas. * A. The type of the data must be the same as the type of the element * B. The number of data in the braces is the same as the length of the array. No more and no less. * * int[] arr = new Int[4] {10, 20, 30,40}; * * int[] arr = new int[] {10, 20, 30, 40, 50, 6, 132}; * The length of the array is determined by the number of elements in the braces. * * int[] arr = {10, 20, 30, 40, 50, 6, 132, 31, 342, 4, 35, 46, 67, 78, 1}; * You can also not write new int[] ... Length is determined by the number of elements we give,*/ //int[] arr = new Int[4] {10, 20, 30, 40}; //int[] arr = new int[] {Ten, 6 , +------------ int[] arr = {Ten, -, -, +, -,6, the, to,342,4, *, $, the, +,1};
2016/04/26 C # arrays