0% found this document useful (0 votes)
13 views2 pages

Arrays and Types of Arrays

The document explains arrays as a data structure for storing multiple values of the same type, commonly used in programming languages like C, C++, Java, and Python. It outlines various types of arrays including one-dimensional, two-dimensional, multi-dimensional, dynamic, jagged, and character arrays, providing examples for each type. This overview highlights the versatility and different structures of arrays in programming.

Uploaded by

piyushinarayan05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Arrays and Types of Arrays

The document explains arrays as a data structure for storing multiple values of the same type, commonly used in programming languages like C, C++, Java, and Python. It outlines various types of arrays including one-dimensional, two-dimensional, multi-dimensional, dynamic, jagged, and character arrays, providing examples for each type. This overview highlights the versatility and different structures of arrays in programming.

Uploaded by

piyushinarayan05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Arrays and Types of Arrays

Arrays in Programming

---------------------

An array is a data structure used to store multiple values of the same type in a single variable.

Arrays are commonly used in many programming languages such as C, C++, Java, and Python.

Types of Arrays

===============

1. One-Dimensional Array

------------------------

A linear list of elements.

Example: int arr[5] = {1, 2, 3, 4, 5};

2. Two-Dimensional Array

------------------------

A table or matrix-like structure (rows and columns).

Example: int matrix[2][3] = {{1, 2, 3}, {4, 5, 6}};

3. Multi-Dimensional Array

--------------------------

An array with more than two dimensions.

Example: int arr[2][2][3];

4. Dynamic Array

----------------
Size can be changed during runtime.

Example (C++ using vectors): vector<int> v;

5. Jagged Array

---------------

An array of arrays where inner arrays can have different lengths.

Example (Java): int[][] jagged = new int[3][];

6. Character Array (String)

---------------------------

Special array used to store characters.

Example: char name[10] = "Alice";

You might also like