What are Jagged Arrarys ?

Showing Answers 1 - 4 of 4 Answers

vishalgupta

  • Jul 13th, 2005
 

jagged array is an array inside an array is called a jagged array

  Was this answer useful?  Yes

kumaraswamy

  • Oct 18th, 2005
 

v     Define Jagged Arrays

The other type of multidimensional array is the jagged array. A two dimensional jagged array can be thought of as a table where each row can have a different number of columns. Take for example, a table where families are the rows and family members are the columns. Unless each family has the same number of members, each row will have a variable number of columns. You can use a jagged array to represent such a table.

A jagged array is really an array of arrays. To create a jagged array, you declare the array of arrays with multiple sets of parentheses or brackets and indicate the size of the jagged array in the first set of brackets (parentheses).

  Was this answer useful?  Yes

kiran

  • Apr 6th, 2006
 

a collection of  discrete no of elements in each and every row is called as jagged arrays.

1)these jagged arrays doesnt contain columns,

2)a jagged array also called as dynamic array

3)jagged array is a collection of dynamic arrays

4)these are faster and also save the memory.

syntax of jagged array:

int[][]x=new int [rows][]

here x is array name

  Was this answer useful?  Yes

sonali panda

  • Apr 13th, 2006
 

Jagged Arrays

Another type of multidimensional array, Jagged Array, is an array of arrays in which the length of each array can differ. Example where this array can be used is to create a table in which the number of columns differ in each row. Say, if row1 has 3 columns, row2 has 3 columns then row3 can have 4 columns, row4 can have 5 columns and so on. The following code demonstrates jagged arrays.

Dim colors(2)() as String
'declaring an array of 3 arrays
colors(0)=New String(){"Red","blue","Green"}
initializing the first array to 3 members and setting values
colors(1)=New String(){"Yellow","Purple","Green","Violet"}
initializing the second array to 4 members and setting values
colors(2)=New String(){"Red","Black","White","Grey","Aqua"}
initializing the third array to 5 members and setting values

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions