Array Initialization

Started by
16 comments, last by RomanR 22 years, 4 months ago
Heh. I noticed. And I'm registered now... maybe now I can go back and edit stuff instead of doing multiple corrective posts. *sigh*

What board does this site run? Is there a list of the commands and other stuff it seems to use.

(like using blocks for html instead <>)

Give a man fire and he''ll be warm for the night. Set a man on fire and he''ll be warm for the rest of his life.

--

Edited by - KwikSilvr on December 18, 2001 10:43:06 AM
--Give a man fire and he''ll be warm for the night. Set a man on fire and he''ll be warm for the rest of his life.
Advertisement
quote:Original post by KwikSilvr
What board does this site run? Is there a list of the commands and other stuff it seems to use.(like using blocks for html instead <>)

i think they wrote their own for gamedev.net (i remember reading that you can license it or something if you want)... there is a link to the forum FAQ at the top of this page, that tells a bit about formatting and stuff...

--- krez (krezisback@aol.com)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
quote:
Ok, wouldn't this declare a 1d array?


Yes it would, but you can still use it as if it was 2 dimensional.
[pre]
C[3][5] would be the same as c[(5*w)+3];
[/pre]

Definately - a preview button...

Edited by - origil on December 18, 2001 11:02:35 AM
The Department of Next Life - Get your Next-Life Insurance here!
Anon poster I think your code will fail no? you are declaring c to by a 1d array and not a 2d array

You are doing the following...

  // Should this not be changed to... D3DColor **c = new *D3DColor[w]D3DColor *c = new D3DColor[w];for(int x = 0; x < w; x++){   // And this change to *c[x] = new D3DColor[h];   c[x] = new D3DColor[h];}  

quote:Original post by ANSI2000
Anon poster I think your code will fail no? you are declaring c to by a 1d array and not a 2d array

You are doing the following...

    // Should this not be changed to... D3DColor **c = new *D3DColor[w]D3DColor *c = new D3DColor[w];for(int x = 0; x < w; x++){   // And this change to *c[x] = new D3DColor[h];   c[x] = new D3DColor[h];}    



you are quite correct. Just goes to show, don''t respond in the morning before you have coffee. And if you make a mistake, don''t propogate it through use of cut & paste.
OK guys thanks for all your replies. I will play around with it some more and get it to work.
Romanroman_rodov@hotmail.com
Use the ** operator....
  D3DCOLOR **c;c = new D3DCOLOR*[w];for (int i = 0; i<w; i++) c[i] = new D3DCOLOR[h];  
You are all champions!!! It works beautifully now!!!
Romanroman_rodov@hotmail.com

This topic is closed to new replies.

Advertisement