--- [EMAIL PROTECTED] wrote:
> I have to write a 3D array and put information in it, so it can be used
> later.
> I'm not sure how to set it up. This is what I have: int var[6][2][7];
> Setting up a single array is easy: {1,2,3,4} but I'm not sure how to do
> anything besides that. Thanks for your help.
Here's a quick example program....
#include <stdio.h>
int main (int argc, const char ** argv)
{
int var[3][3][3] = {
{
{ 1,2,3 },
{ 4,5,6 },
{ 7,8,9 }
},
{
{ 10,11,12 },
{ 13,14,15 },
{ 16,17,18 },
},
{
{ 19,20,21 },
{ 22,23,24 },
{ 25,26,27 },
}
};
int i,j,k;
for(i = 0; i<3; i++)
{
for(j = 0; j <3; j++)
{
for(k=0;k<3;k++)
{
printf("var[%d][%d][%d] = %d\n", i,j,k,var[i][j][k]);
}
}
}
return 0;
}
=====
-----BEGIN GEEK CODE BLOCK-----
Version 3.1
GCS/L/C/O d-(+) s++: a-- C+++$>++++ UBLS++++$
P+++(--)$ L+++>++++ E--- W+>++$ N !o K? w(--) !O
M- !V PS+ PE(++) Y+ PGP->+ t+ 5 X+() R(+) tv+@
b++(+++) !DI+++ D G(-) e>+++$ h---() r+++ y+++
------END GEEK CODE BLOCK------
__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/