[SDL] Question about arrays...

matt mattmatteh at earthlink.net
Fri Feb 9 11:40:40 PST 2007


matt wrote:
> SlntHero at aol.com wrote:
>   
>> 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_ (mailto:SLNTHERO at AOL.com) 
>> _http://www.SilentHeroProductions.com_ (http://www.SilentHeroProductions.com) 
>>  
>>
>>   
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> SDL mailing list
>> SDL at lists.libsdl.org
>> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>>   
>>     
> this is not an sdl question.
>
> int stuff[3][3] = {{1,2,3},{4,5,6},{7,8,9}};
>
> also, is Int8 part of sdl?  i thought Uint8 was.   anyway, i just
> include stdint.h and use uint8_t or int_t.
>
> matt
>   
i just tried that without the extra curly braces and it still compiled
but gave a warning.  i only code i C not C++  so i cant help with that.

matt


More information about the SDL mailing list