CS 1100 Lecture Notes - Lecture 24: Data Type
Document Summary
Last chapter we learned about single dimensional arrays (a line of values [elements]) Can also have multidimensional arrays (2d arrays, 3d arrays, etc. ) A 2d array has rows and columns and forms a grid/spread sheet like structure. A 3d array is like a cuboid, or rubics cube. 4d arrays, 5d arrays, etc. are possible, but not often used. It gets too confusing working with things more than 3 dimensions. Game board, a matrix, table of data, etc. Syntax for 2d array just like 1d arrays, but extra pair of []s. Each element in a 2d array has two indices. Int[][] x = new int[3][4]; x. length is number of rows to get the size of a particular row, index into x at that column x[3]. length ofte(cid:374), ea(cid:272)h ro(cid:449) is the sa(cid:373)e size, (cid:271)ut it s possi(cid:271)le to ha(cid:448)e differe(cid:374)t sizes. Processing 2d arrays as with 1d arrays, for loops are often used for processing 2d arrays.