#mastery<\/a>24 #TC<\/a>1017<\/p>\n Creation and use of vectors in C++<\/span><\/p>\n C++ provides a data structure,\u00a0the array, which stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type.<\/span><\/p>\n Instead of declaring individual variables, such as number0, number1, …, and number99, you declare one array variable such as numbers and use numbers[0], numbers[1], and …, numbers[99] to represent individual variables. A specific element in an array is accessed by an index.<\/span><\/p>\n All arrays consist of contiguous memory locations. The lowest address corresponds to the first element and the highest address to the last element.<\/span><\/p>\n Declaring Arrays:<\/span><\/p>\n To declare an array in C++, the programmer specifies the type of the elements and the number of elements required by an array as follows:<\/span><\/p>\n #D6D6D6 1.0pt; mso-border-alt: solid #D<\/a>6D6D6 .75pt; padding: 4.0pt 4.0pt 4.0pt 4.0pt; background: #EEEEEE;”><\/p>\n type arrayName <\/span>[<\/span> arraySize <\/span>];<\/span><\/p>\n<\/div>\n This is called a single-dimension array. The\u00a0arraySize\u00a0must be an integer constant greater than zero and\u00a0type\u00a0can be any valid C++ data type. For example, to declare a 10-element array called balance of type double, use this statement:<\/span><\/p>\n \u00a0<\/p>\n #D6D6D6 1.0pt; mso-border-alt: solid #D<\/a>6D6D6 .75pt; padding: 4.0pt 4.0pt 4.0pt 4.0pt; background: #EEEEEE;”><\/p>\n double<\/span> balance<\/span>[<\/span>10<\/span>];<\/span><\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":" #mastery<\/a>24 #TC<\/a>1017<\/p>\n Creation and use of vectors in C++<\/span><\/p>\n C++ provides a data structure, the array, which stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type.<\/span><\/p>\n Instead of declaring individual variables, such as number0, number1, …, and number99, you declare one array variable such as numbers and use numbers[0], numbers[1], and …, numbers[99] to represent individual variables. A specific element in an array is accessed by an index.<\/span><\/p>\n All arrays consist of contiguous memory locations. The lowest address corresponds to the first element and the highest address to the last element.<\/span><\/p>\n Declaring Arrays:<\/span><\/p>\n To declare an array in C++, the programmer specifies the type of the elements and the number of elements required by an array as follows:<\/span><\/p>\n