CS 0401 Lecture 8: 1.31.17 Array Review, Passing arrays and Filling an Array from a File
Document Summary
Collection of values of the same type stores consecutively in memory int arr[] = new int[5]; New int[5]; - allocates a chunk of memory big enough for 5 ints: will bring back the address of that chunk of memory (or throw exception if out of memory) Int arr[] creates a reference variable named arr: contains address of the first cell in memory chunk. The arr points to/ references the beginning of the array. Object: chunk of memory arr[i] = i*2; putting values into the array. For (int i=0 ; i< arr. length ; i++ ) array = [0][2][4][6][8] . length : asking how many cells of capacity the array has. array discipline: rules to follow in order to use an array correctly. When you declare an array you should declare an int names count or such to track how many value you have put into the array.