digitalmars.D - How to create multidimesinal array
- Andrew Fedoniouk (14/14) Feb 12 2005 public struct Color
- Unknown W. Brackets (5/25) Feb 12 2005 For dynamic arrays, you don't use that syntax but rather:
- Chris Sauls (9/37) Feb 12 2005 Or use
- Andrew Fedoniouk (5/42) Feb 12 2005 Thanks, Chris,
- Chris Sauls (5/10) Feb 13 2005 Yes it does leave one with an odd aftertaste. So Walter, I'd like to
public struct Color { byte r,g,b,a; }; public Color[][] frameBuffer; attempt to use: frameBuffer = new Color[height][width]; where width and height some integer variables produces: alphablend.d(54): Integer constant expression expected instead of height alphablend.d(54): cannot implicitly convert expression new Color [0][](width) of type Color [0][] to Color [][] Thanks in advance, Andrew Fedoniouk. http://terrainformatica.com
Feb 12 2005
For dynamic arrays, you don't use that syntax but rather: frameBuffer.length = height; for (int i = 0; i < height; i++) frameBuffer[i].length = width; -[Unknown]public struct Color { byte r,g,b,a; }; public Color[][] frameBuffer; attempt to use: frameBuffer = new Color[height][width]; where width and height some integer variables produces: alphablend.d(54): Integer constant expression expected instead of height alphablend.d(54): cannot implicitly convert expression new Color [0][](width) of type Color [0][] to Color [][] Thanks in advance, Andrew Fedoniouk. http://terrainformatica.com
Feb 12 2005
Or use -- Chris S Unknown W. Brackets wrote:For dynamic arrays, you don't use that syntax but rather: frameBuffer.length = height; for (int i = 0; i < height; i++) frameBuffer[i].length = width; -[Unknown]public struct Color { byte r,g,b,a; }; public Color[][] frameBuffer; attempt to use: frameBuffer = new Color[height][width]; where width and height some integer variables produces: alphablend.d(54): Integer constant expression expected instead of height alphablend.d(54): cannot implicitly convert expression new Color [0][](width) of type Color [0][] to Color [][] Thanks in advance, Andrew Fedoniouk. http://terrainformatica.com
Feb 12 2005
Thanks, Chris, Little bit "non-symmetric" with static declaration like int[3][3] but works. Andrew Fedoniouk. "Chris Sauls" <ibisbasenji gmail.com> wrote in message news:cukjsa$15j1$1 digitaldaemon.com...Or use -- Chris S Unknown W. Brackets wrote:For dynamic arrays, you don't use that syntax but rather: frameBuffer.length = height; for (int i = 0; i < height; i++) frameBuffer[i].length = width; -[Unknown]public struct Color { byte r,g,b,a; }; public Color[][] frameBuffer; attempt to use: frameBuffer = new Color[height][width]; where width and height some integer variables produces: alphablend.d(54): Integer constant expression expected instead of height alphablend.d(54): cannot implicitly convert expression new Color [0][](width) of type Color [0][] to Color [][] Thanks in advance, Andrew Fedoniouk. http://terrainformatica.com
Feb 12 2005
Yes it does leave one with an odd aftertaste. So Walter, I'd like to difficult? -- Chris S Andrew Fedoniouk wrote:Thanks, Chris, Little bit "non-symmetric" with static declaration like int[3][3] but works. Andrew Fedoniouk.
Feb 13 2005