Javatpoint Logo
Javatpoint Logo

Go Array

In Go, an array is a homogeneous data structure (Fix type) and has a fixed-length. The type can be anything like integers, string or self-defined type.

The items in the array can be accessed through their index, It starts with zero. The number of items in the array is called the length or size of an array. It is fixed and must be declared in the declaration of an array variable.

Syntax:

Example:

Go Array Example

Output:

Element[0] = 10
Element[1] = 11
Element[2] = 12
Element[3] = 13
Element[4] = 14

Go Multi Dimensional Arrays

Multi dimensional arrays is simply a list of one-dimensional arrays.

Sytax:

Example:

Initializing Two-Dimensional Arrays

Accessing Two-Dimensional Arrays


Go Multi-Dimensional Array Example

Output:

123
456
789

Next TopicGo Slice





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA