---
title: "Jagged Arrays in C#"  
description: "In this post, we will learn about Jagged Arrays in C# with an example.  Description    A Jagged array is an array of arrays. Jagged Array is also call"  
author: "Krunal Sisodiya"  
published: 2017-11-27  
updated: 2018-03-21  
canonical: https://www.mindstick.com/blog/11595/jagged-arrays-in-c-sharp  
category: "c#"  
tags: ["c#", ".net"]  
reading_time: 2 minutes  

---

# Jagged Arrays in C#

In this post, we will learn about [Jagged Arrays](https://answers.mindstick.com/qa/92481/what-are-jagged-arrays) in C# with an example.\
Description\
\
A [Jagged array](https://www.mindstick.com/articles/335/jagged-array-in-c-sharp-dot-net) is an [array of arrays](https://www.mindstick.com/forum/186/making-an-array-of-arrays). Jagged Array is also called “array of arrays” because its [elements](https://www.mindstick.com/forum/1440/wpf-button-with-multiple-text-elements) are arrays. The element size of a jagged array can be different. \
\
**Types of [Arrays in C#](https://www.mindstick.com/forum/159856/how-to-create-and-work-with-arrays-in-c-sharp)**\
\
**Arrays can be divided into the following three categories.**\
\
Single-dimensional arrays\
Multidimensional arrays or rectangular arrays\
Jagged arrays\
\
Declaration of Jagged Array\
\
Declare jagged array that has two elements.\
\
int[][] _RollNumber = new int[2][];\
\
**[Initialization](https://www.mindstick.com/interview/160/what-is-the-difference-between-assignment-and-initialization) of Jagged Array**\
\
Write the below lines to initialize a Jagged Array. The size of the elements can be different.

_RollNumber[0] = new int[2]; \
_RollNumberr[1] = new int[3];

Now, create a in [Visual Studio](https://www.mindstick.com/articles/12378/visual-studio-for-mac-is-out-of-beta-preview-now-officially-available) and write the below lines of code in it.

```
    using System;        using System.Collections;        using System.Collections.Generic;        namespace ConsoleDemo        {            class Program            {                static void Main(string[] args)                {                    // Jagged Array Example                    int[][] _JaggedArrayExample = new int[2][];// Declare jagged array                      _JaggedArrayExample[0] = new int[] { 11, 21, 31, 41 };// Initialize the array with value                           _JaggedArrayExample[1] = new int[] { 42, 52, 62, 72, 83, 93 };                    // Raed and print array elements                      for (int i = 0; i < __JaggedArrayExample.Length; i++)                    {                        for (int j = 0; j < __JaggedArrayExample[i].Length; j++)                        {                            System.Console.Write(__JaggedArrayExample[i][j] + " ");                        }                        System.Console.WriteLine();                    }                    Console.ReadKey();                }            }            }   
```

**Output**\
\
11 21 31 41\
42 52 62 72 83 93\
\
**Summary\**\
I hope you understood Jagged Arrays in C#. [Your valuable](https://www.mindstick.com/articles/23598/best-wedding-photographer-inspire-the-best-to-protect-your-valuable-minutes) [questions](https://www.mindstick.com/blog/124895/hp-hpe0-s54-cheat-sheet-exam-questions-bank-for-guaranteed-success), [feedback](https://www.mindstick.com/articles/12731/the-importance-of-feedback-to-the-user-experience), or comments about this article are always welcome.\
\
\

---

Original Source: https://www.mindstick.com/blog/11595/jagged-arrays-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
