---
# System prepended metadata

title: Untitled

---



[Cue Card 1: Definition of Arrays]
- Arrays are a collection or systematic arrangement of objects of the same data type.
- can be used to store and manage multiple elements of the same data type in a single structure 
    * i.e. provides systematic arrangement and efficient storage of elements.
* can be one-dimensional, two-dimensional, or even multi-dimensional.

[Cue Card 2: Declaration and Initialization of Arrays]
- To declare arrays specify data type, variable name, and size.
    - ex- an integer array named "marks" with a size of 10 can be declared as: int marks[10].
- Arrays can also be initialized during declaration 
    * ex- int marks[5] = {85, 92, 78, 90, 87} initializes an integer array "marks" with specific values.

[Cue Card 3: Utility of Arrays]
- Arrays are useful for storing and accessing multiple elements efficiently.
- Enable operations such as searching, sorting, and calculating averages or sums.

[Cue Card 4: Memory Storage of Arrays]
- In computer memory, arrays are stored as contiguous blocks of memory.
- Each element in the array occupies a specific memory location based on its index.
- The memory addresses are assigned sequentially, starting from 0 for the first element.
- Accessing array elements is fast and efficient due to their continuous storage in memory.

[Cue Card 5: Pointer Arithmetic and Array Access]
- Arrays can be accessed using pointer arithmetic in C, C++ *(Java doesn’t have pointers but internal working and storage of array elements in memory follows the same set of rules.)*
- The name of the array acts as a pointer to the first element of the array.
- By incrementing the pointer, we can access subsequent elements in the array.
    - ex- *(marks + 2) retrieves the value at the third index of the array "marks".

[Cue Card 6: Example of Array Manipulation]
- Suppose we have an array "marks" representing the marks of 10 students in a class.
- We can calculate the sum of all marks by iterating over the array and adding each element to a running total.
- To find the average, we divide the sum by the total number of students.

