Re: [go-nuts] How to initialize two dimension array

2016-08-19 Thread asit dhal
Here is a link to initialize a static array http://www.dotnetperls.com/2d-go And at runtime, https://rosettacode.org/wiki/Create_a_two-dimensional_array_at_runtime#Go Warm Regards, Asit Dhal http://bit.ly/193ASIT On 8/18/2016 6:19:57 PM, Seb Binet wrote: On Thu, Aug 18, 2016 at 9:32 AM, mailt

Re: [go-nuts] How to initialize two dimension array

2016-08-18 Thread Seb Binet
On Thu, Aug 18, 2016 at 9:32 AM, wrote: > func Pic(dx, dy int) [][]uint8 { > pic := make([][]uint8, dy) > for i := 0; i < dy; i++ { > pic[i] = make([]uint8, dx) > for j := 0; j < dx; j++ { > pic[i][j] = uint8(float64(i)*math.Log(float64(j))) > } > } > return pic > } > > [][]uint8 is not an array:

Re: [go-nuts] How to initialize two dimension array

2016-08-18 Thread alexanderyau92
func Pic(dx, dy int) [][]uint8 { pic := make([][]uint8, dy) for i := 0; i < dy; i++ { pic[i] = make([]uint8, dx) for j := 0; j < dx; j++ { pic[i][j] = uint8(float64(i)*math.Log(float64(j))) } } return pic } 在 2010年5月5日星期三 UTC+8上午12:30:56,Yang Yang写道: > > Hi, All > > I'm new to Go programming la