reply to GEORGE KRYKARISS
Oya Ekin
kcfy at hp1.ccs.cornell.EDU
Mon Feb 15 14:22:56 AEST 1988
GEORGE KYRIAZISSS writes ::
> Hello world. I first found that peculiar behaviour trying to
> write a computer graphics program involving points, lines and polygons.
> Anyway, here it is:
>
> int (*lines)[2];
> main() {}
>
>is a dummy program that just defines this data structure. What I actually
>want is a pointer to arrays of 2 ints. I believe that int *lines[2] will
>do the reverse, ie. give me two pointers to int.
>Anyway, when I run it thru dbx on a SUN and ask 'whatis lines' I get this:
>
> int (*lines)[8196];
>
>As far as I know, this is a *BIG* mistake? Or am I wrong?
>
>
I do not quite understand how you are going to use a declaration like
the one you gave. BUT You are right ... I compiled this on Vax it
gives me array[0..1] of (*lines) but I do not understand how you are
going to use this even if it is declared correctly as in VAX.
MAYBE you need something like :
int *lines ;
main()
{
lines = calloc(2*n,sizeof(int)) ;
}
to create arrays of 2 ints refernced as
for example for a point :
line[n] for x and line[n+1] for y ;
Am I right ? OR do you need it for anything else ..
********************************************************************
* MALAGAS ......??
********************************************
More information about the Comp.lang.c
mailing list