Technology Guruu

  • Home
  • Site Info
    • About Us
    • Disclaimer
    • Privacy Polacy
  • Home
  • Digital Marketing
    • SEO
    • SMM
    • SEM
  • Quotes
  • Technical
  • Java
  • .Net
    • C#.Net
    • ASP.Net
  • Keychains

Monday, 20 June 2016

Arrays brief description in C#

 Akansha     18:00:00     TechnicalQuestions     No comments   

Arrays are the best and important topic for every programming developer take the help of arrays.Arrays are used to store multiple values at a time and in these we are providing how to store he values in single dimentional array and what is the syntax of single dimentional array and give a detailed explanation with examples and what is the use of multi Dimentional array and syntax ,examples and jagged array it is very helpful to write critical logical programs.

Arrays detailed explanation with examples

Arrays
  • Array is a user defined reference type datatype which is used to store multiple values of same datatype in a single variable.
  • Array is used hold multiple values of same data type temporarly until the program is running type temporarly until the program is running.
  • Array is used to allocate the memory in continuous memory location that is side by side..
  • Always the index of array start fro 0 to size-1..

Types Of Arrays

1.Single dimentional arrays
2.Multi dimentional Arrays
3.Jagged Array

Single Dimentional Array

It is used to store homogeneous values in a single variable.
Datatype[] arrayname=new Datatype[arraysize]
Syntax to store the value in the Array
arrayname[index]=value;
Syntax to display the value from the Array
arrayname[index]
Example
class A
{
static void main()
{
int[] ar=new int[5];
Ar[0]=10;
Ar[1]=20;
Ar[2]=30;
Ar[3]=40;
Ar[4]=50;
for(int i=0;i<=4;i++)
{
Console.WriteLine(Ar[i]);
}
}

Multi Dimentional Array

Array is used display the data in matrix format
Datatype[,] Arrayname=new Datatype[noofrows,noofcolums];
Syntax to store the value in the array
Arrayname[rowindex,columnindex]=value;
Example
using system;
class A
{
static void main()
{
int[,] Ar=new int[2,3];
Ar[0,0]=10;
Ar[0,1]=20;
Ar[0,2]=30;
Ar[1,0]=40;
Ar[1,1]=50;
Ar[1,2]=60;
for(int i=0;i<=1;i++)
{
for(int j=0;j<=2;j++)
{
Console.WriteLine(Ar[j,i]);
}
Console.WriteLine();
}
}
Syntax to Declare Multidimentiona Array
Datatype[,] Arrayname=new Datatype[noofrows,noofcolumns]{{row1values},{row2values}};
Example
string[,] Ar=new String[2,3]{{"c","c++","java"},{"mvc","c#","SQL"}};
for(int r=0;r<=1;r++)
{
for(int c=0;c<=2;c++)
{
Console.WriteLine(r,c);
}
Console.WriteLine();
}

Jagged Array

Array inside another Array is Jagged Array
Syntax
Datatype[][] Arrayname=new Datatype[noofrows][];
Example
using system;
class A
{
static void main()
{
int[][] Ar=new int[4][];
Ar[0]=new int[1]{10};
Ar[1]=new int[2]{20.30};
Ar[2]=new int[3]{40,50,60}
Ar[4]=new int[4]{70,80,90,100};
for(int r=0;r<=3;r++)
{
for(int c=0;c<=Ar[i].length-1;c++)
{
Console.WriteLine(Ar[r][c]+"\t");
}
Console.WriteLine();
}
}
}
Friends you like My Post Please Share to Your Friends through Social Media(Facebook,Twitter,Google+).You Feel free comment on my post.
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Popular Posts

  • Missing My Friend Quotes : Friendship Day Quotes 2017
    Friends today my article about missing friends and moments with them. Here you are seen the best friendship quotes and some  feelings when...
  • Brief description about Delegates
    Introduction about delegates and why delegates are came the main purpose of delegates how to useful and what are the advantages and disadv...
  • Detail Introduction about C#.Net
    Brief Introduction about C#.Net  Introduction C#.Net is the one of the Programming Language the .Net Framework also contains ano...
  • Na Tanu Samjhawan Ki Song lyrics
    Na Tanu Samjhawan Ki Song Lyrics With English Translation Movie : Humpty Sharma ki Dulhaniya Song : Samjhawan Song Singer : Arijit ...
  • Love Failure Quotes and Sad valentines day Quotes
    We Love Someone is a easy process sometime takes long time to love someone love others within short period but anyway always love dependin...
  • Best Good Afternoon wishes greetings and quotes
    Top Most Good Afternoon Wishes Good Afternoon wishes are gives a relaxation in afternoon time.This wishing can be done between 12 to 3 p...
  • Top 10 valentine's day Quotes and Greetings wishes
    All Lovers have Anxiety in Valentines day because it is a festival to all lovers in these they enjoy a lot and celebrate the Valentine...
  • Letter B wallpapers and keychains for facebook
    In these we are Providing Letter B Wallpapers and awesome Key chains also Some Facebook Profile Pictures and cover photos also we are prov...
  • Brief Description about Multicast Delegate
    Multicast delegate is an extension of normal delegate. It helps you to point more than one method at a single moment of time. Multicast ...
  • How to Remove Audio From Any Video Using VLC Media Player?
    Step by Step Procedure for  Remove(Mute) Audio in a Video Using VLC  Player A picture is worth a thousand words and a video is worth a t...

Categories

  • Entertainment (67)
  • TechnicalQuestions (58)
  • Quotes (11)
  • C#.Net (8)
  • Java (8)
  • ValentinesDay (4)
  • SEO (3)
  • Home
  • About Us
  • Disclaimer
  • Privacy Policy
  • Sitemap

Copyright © 2015-2017 Good Friends 5.All Rights Reserved• And Our Sitemap • All Logos and Trademark Belongs To Their Respective Owners•