CH - 7C++ Arrays
CH - 7C++ Arrays
LANGUAGE
C++ Arrays
OBJECTIVES
Introduction of an array
Array definitions
Accessing array elements
Usage off Array
Types of Array
Examples of Array
Summary
INTRODUCTION OF AN
ARRAY
An array is a collection of similar elements. These similar
elements could be all ints, or all floats, or all chars, etc.
and number99, you declare one array variable such as numbers and use
numbers[0], numbers[1], and ..., numbers[99] to represent individual
variables.
ACCESSING ARRAY
ELEMENTS
A specific element in an array is accessed by an index.
balance[5]=50.0;
int main() {
int numbers[5]={16,26,36,46,56};
cout<<numbers[2];
return 0;
}
USAGE OF ARRAY
Arrays are used to process a large amount of data of same data
program
C++ ARRAYS AND LOOPS
You can loop through the array elements with the for loop.
}
TYPES OF ARRAY
One Dimensional Arrays
dimensional array.
The first indexed value represents the total number of rows and
Syntax:
XXXXXXXXX
XXXXXXXXX
XXXXXXXXX
XXXXXXXXX
SUMMARY
In C++, an array is a variable that can store multiple values of
program
Variable holds single value of any type. i.e. int, float and char.