One Dimensional Array in C#

one-dimensional-array
In this chapter you will learn:

  • What is single dimensional array?
  • How to declare one dimensional array?
  • How to use single dimensional array in C# programming?

The one dimensional array or single dimensional array in C# is the simplest type of array that contains only one row for storing data. It has single set of square bracket (“[]”). To declare single dimensional array in C#, you can write the following code.

The array age is a one dimensional array that contains only 5 elements in a single row.

Programming Example of One Dimensional Array:

onedimensional-array-flowchart

Output

All the element of Books array is:

1       2        3              4        5

C#    Java    VB.NET    C++    C
__

 

Summary

In this chapter you learned about single dimensional array in C#. You also learned how to store value and access value from single dimensional array. In next chapter you will learn about multi dimensional array in C#.

Write a Reply or Comment

Your email address will not be published.