Logo/

Basic Programming: Array and String

Log in

Made with ScholarlyMake flashcards like these from your own notes

Basic Programming: Array and String

Questions and answers

9 cards
  1. Question:What is an Array?

    Answer:A data structure to store a fixed-size sequential collection of elements of the same type.

  2. Question:Why use arrays?

    Answer:To manage a collection of consecutive individual variables.

  3. Question:How do you declare an array?

    Answer:DataType arrayName[arraySize];

  4. Question:How do you access an element in an array?

    Answer:Through the array name and the location of the element in the array.

  5. Question:How do you initialize an array?

    Answer:DataType arrayName[arraySize] = {element1, element2, ..., elementn};

  6. Question:What is a 2-dimensional array?

    Answer:An array with two dimensions or a matrix.

  7. Question:How do you declare and access elements in a 2-dimensional array?

    Answer:DataType arrayName[rowSize][columnSize]; and arrayName[rowIndex][columnIndex];

  8. Question:What is a 3-dimensional array?

    Answer:An array with three dimensions.

  9. Question:How do you declare and access elements in a 3-dimensional array?

    Answer:DataType arrayName[layerSize][rowSize][columnSize]; and arrayName[layerIndex][rowIndex][columnIndex];