Click here to Skip to main content
15,850,917 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
How can you assign set of user given string inputs to a jagged array?

Number of input sentences may differ from user to user.

Example :- child ate rice. We went on a trip. <= Input is a user given one (through a text box). Each sentence must be allocated each row and words to columns.

row and Column values of the array
array[0] [] = child ate rice. <= first row
array[1] [] = We went on a trip <= second row

array[0] [0] =>child
array[0] [1] => ate

How can I access the last index of each row?

Thank you.
[no name] 20-Jun-11 23:56pm    
Or Yahoo! Search it, Bing it, or wing it.

You problem is reduced to the following one: how to get length of array in each of its (two in your case) dimensions.

If your rows and columns numbers are zero-based (which is the default), use the method System.Array.GetLength(int dimension), see[^].

You can also find your bound of indexing for non zero-based arrays. For this purpose, use the methods System.Array.GetLowBound(int dimension) and System.Array.GetUpperBound(int dimension). See:[^],[^].

Share this answer
I suppose this link will help you
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900