Made with ScholarlyMake flashcards like these from your own notes
Question:What is an Array?
Answer:A data structure to store a fixed-size sequential collection of elements of the same type.
Question:Why use arrays?
Answer:To manage a collection of consecutive individual variables.
Question:How do you declare an array?
Answer:DataType arrayName[arraySize];
Question:How do you access an element in an array?
Answer:Through the array name and the location of the element in the array.
Question:How do you initialize an array?
Answer:DataType arrayName[arraySize] = {element1, element2, ..., elementn};
Question:What is a 2-dimensional array?
Answer:An array with two dimensions or a matrix.
Question:How do you declare and access elements in a 2-dimensional array?
Answer:DataType arrayName[rowSize][columnSize]; and arrayName[rowIndex][columnIndex];
Question:What is a 3-dimensional array?
Answer:An array with three dimensions.
Question:How do you declare and access elements in a 3-dimensional array?
Answer:DataType arrayName[layerSize][rowSize][columnSize]; and arrayName[layerIndex][rowIndex][columnIndex];