This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: help ! sos !


On Tue, 31 Aug 1999 10:47:08 -0700, Debojyoti Dutta <ddutta@halcyon.usc.edu> wrote:

>i am trying to understand the way gcc works. in particular, i am
>interested in figuring how multidimentional arrays are handled in gcc. 
>
>can someone please help.

unsigned short int   JUNK[3][3][3] = {1,2,3,4,5,6,7,8,9,   etc,...};

unsigned short int * JUNK_POINTER;

JUNK_POINTER = JUNK;

for (i = 0; i < 27; i++)
{    printf("%i\n", *(JUNK_POINTER + i)
}

This will show you the order of variables stored in memory ... you can relate that to the
way the array JUNK is initialized.  You may have to do a funny cast on the JUNK_POINTER in
the printf statement before you can add the integer "i" to it..

Good Luck ... This is pretty basic stuff ...



All the best, and ENJOY!

Art Du Rea
Knoxville, Tennessee, USA

(Remove NOGI:NOGO for direct e-mail)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]