In this article I would like to share how to declare and use two-dimensional arrays using Go programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

Program Listing

package main

import "fmt"

func main() {
	/* An array with 3 rows and 3 columns
	   with initialize values
	*/
	var a = [3][3]int{{10, 20, 30}, {40, 50, 60}, {70, 80, 90}}

	var i, j int

	fmt.Print("\n")
	fmt.Print("\tExample of Two Dimensional Arrays in Go\n\n")
	/* output each array element's value */
	for i = 0; i < 3; i++ {
		for j = 0; j < 3; j++ {
			fmt.Printf("\ta[%d][%d] = %d\n", i, j, a[i][j])
		}
	}
	fmt.Print("\n\n")
	fmt.Print("\tEnd of Program")
	fmt.Print("\n")
}