Tech Study

Write C# Program to Demonstrate Jagged Arrays

Introduction

I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability.

using System;
class Program
{
    static void Main()
    {
        int[][] jagArray = new int[3][];
        jagArray[0] = new int[2];
        jagArray[0][0] = 12;
        jagArray[0][1] = 13;
        jagArray[1] = new int[1] { 12 };
        jagArray[2] = new int[3] { 15, 16, 17 };
        for (int i = 0; i < jagArray.Length; i++)
        {
            int[] innerArray = jagArray[i];
            for (int a = 0; a < innerArray.Length; a++)
            {
                Console.WriteLine(innerArray[a] + " ");
            }
        }
        Console.Read();
    }
}

Result

Write C# Program to Demonstrate Jagged Arrays
Write C# Program to Demonstrate Jagged Arrays

TaggedWrite C# Program to Demonstrate Jagged Arrays

Python Examples

Introduction: Python Examples are the basic programming concepts of python like python syntax,python data types,,python operators,python if else,python comments etc.. …

Read more

C String Functions

C String Functions perform certain operations, It provides many useful string functions which can come into action. The <string.h> header …

Read more