Sunday, 1 September 2013

jagged array .

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

namespace jaggedAreray
{
   class Program
   {
       static void Main(string[] args)
       {
           int[][] jaggedArray = new int[3][];
           jaggedArray[0] = new int[2];
           int i,j;

           jaggedArray[0][0]=1;
           jaggedArray[0][1] =2;

           jaggedArray[1] = new int[1];
           jaggedArray[2] = new int[3] { 3, 4, 5 };


           for (i = 0; i < jaggedArray.Length; i++)
           {
               int[] jagged = jaggedArray[i];

               for (j = 0; j < jagged.Length; j++)
               {
                   Console.WriteLine(jagged[j]+""
);

               }
               Console.WriteLine();
           }



       }
   }
}

No comments:

Post a Comment