[SDL] Question about arrays...

Alexander Popp feuerbowle at googlemail.com
Fri Feb 9 11:08:04 PST 2007


Hi,

maybe this works:

Playfield = { "0, 1, 0", "1, 1, 1", "0, 1, 1"};

but i´m not sure if you can initialize the array in the way like this at
runtime. As far as i know this way only works at the definition.

like:

Int8 Playfield[3][3] = { "0, 1, 0", "1, 1, 1", "0, 1, 1"};

but this is only smattering because i´m a C++ beginner.

Alex


P.S. So this is my first post on a mailinglist please be clement if a do
anything wrong.


2007/2/9, SlntHero at aol.com <SlntHero at aol.com>:
>
>  Question about arrays...
>
>
> Hi,
>
> I have a C++ Class with the following:
> Int8 Playfield[3][3];
>
> Later in my program I wish to initialize the above 2 dimensional array
> with the following values:
> 0 / 1 / 0
> 1 / 1 / 1
> 0 / 1 / 0
>
> I tried the following, but it does not compile:
>
> Playfield
> = { 0, 1, 0,
>      1, 1, 1,
>      0, 1, 1 };
>
> Can someone tell me how to do the above correctly?
>
> Thanks in advance!
>
>
> Jesse
> SLNTHERO at AOL.com
> http://www.SilentHeroProductions.com
>
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20070209/e3a08b2e/attachment.html 


More information about the SDL mailing list