Jagged Array-- An array which contains another array with in it is known as jagged array. a jagged array is known as Arrays of array
Program using foreach loop in jagged array.
using System;.
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ram
{
class Program
{
static void Main(string[] args)
{
int[][] A = new int[3][];
A[0] = new int[5] { 23, 34, 43, 12, 89 };
A[1]=new int[4] {87, 76, 90, 98};
A[2]=new int[6] {34,5,6,8,76,98};
Console.WriteLine("elements of jagged array are :-");
foreach(int[] i in A)
{
foreach(int j in i)
{
Console.Write(j+" ");
}
Console.WriteLine();
}
Console.Read();
}
}
}