Lecture 5 - Arrays and Structs Flashcards
organized collection of values that may be used for data together with a set of operations that may be performed with the data.
Data Structures
data whose values are directly supported in the hardware of the computer (int, float, double, char)
Elementary or Scalar
contains group of scalars, each accessed by a referencing mechanism. (array, records, structures)
Structure
data types that are defined by the developers (enumeration, type declaration)
Abstract
a finite, ordered collection of homogeneous elements, each accessed through a subscript value.
Arrays
all the elements are arranged in order (first, second, third, and so on)
ordered
there is a specific number of elements in the array
finite
all the elements in the array must be of the same type (e.g. all integers, all characters or all floating point)
homogeneous
type of the values used to access the individual elements of the array
Index (subscript type)
type of elements or components
of the array.
Base Type (common type)
specifies the position of the component of the array
indexExp
How to Declare Arrays?
dataType, array_name, array_size
How to Initialize Arrays
dataType array_name
usually enclosed in brackets, determines the number of elements that an array has to contain
array_size
How to access arrays
array_name[indexExp]