Jagged Array



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] employee=new string[3        ];
            employee[0] = "sam";
            employee[1] = "mat";
            employee[2] = "max";
            string[][] jaggedArray=new string[3][];
            jaggedArray[0] = new string[3];
            jaggedArray[1] = new string[1];
            jaggedArray[2] = new string[2];

            jaggedArray[0][0] = "BACHELOR";
            jaggedArray[0][1] = "MASTERS";
            jaggedArray[0][2] = "DOCTORATE";

            jaggedArray[1][0] = "BACHELOR";
            jaggedArray[2][0] = "MASTERS";
            for (int i = 0; i < employee.Length; i++)
            {
                Console.WriteLine(employee[i]);
                Console.WriteLine("---------=");
                string[] innerArray = jaggedArray[i];
                for (int j = 0; j < innerArray.Length; j++)
                {
                    Console.WriteLine(innerArray[j]);
                }
                Console.WriteLine();

            }
            Console.Read();
        }
    }
}

Comments