Calling real c-men...

Jit Keong Tan jit at SLIC.CELLBIO.DUKE.EDU
Tue Apr 9 14:08:03 AEST 1991


In article <9104082133.AA15472 at karron.med.nyu.edu>

>>void NitherNoid(int mm,float llist[][2][3],float point[3]);

This is no difference than 
void NitherNoid(int mm,float llist[][][],float point[]);
or
void NitherNoid(int mm, float ***llist, float *point);

the compiler will ignore the dimension that you declare in function
prototyping.
----

>>    float *svd_line_list[2][3]; /* a list of pointers to lines */

>>    svd_line_list=(void *)0;
    (I suppose you mean float * instead of void * cast)

There is a misconception of array and pointers here.  you first declare
svd_line_list as an array, then you treat it as a pointer, this is wrong.
Because you did not tell the compiler where you want to store the 
value (float *)0

Let's do it step by step, (and I hope this is what you want)

1) svd_line_list[0][0] = (float *)0;   /* assign 1st element to be NULL */
2) *svd_line_list[0] = (float *)0;     /* same thing */

/* same difference, just look more impressive :-) */
3) **svd_line_list = (float *)0; 
	
For all other similar problems, if you do the translation step by step in terms
of array before converting them into pointers, lots of problem can be avoided.

I didn't try to read carefully want you want but I guess you are trying to
pass the dimension of array into a function.  How about include its
dimension in the structure such as

typedef struct CompositeTag {
	int hot_spots = HOT_SPOTS;    /* <==== These two are added */
	int hot_lines = HOT_LINES;    /* <==== These two are added */
        struct LineTag *HotLinePointer;
        struct LineTag SkeweringLines[HOT_SPOTS][HOT_LINES];
        struct LineTag LineTween[HOT_SPOTS][HOT_LINES];
        Matrix CompositeMatrix;
        int NumberCompositeStacks,HotStack,
                HotSlice,HotCardinal,HotLine;
        char CompositeName[80];
        } Composite;

Because C doesn't care about array bound at all.

Hope this help.

--------------------------------------------------------
Jit Keong Tan     | internet: jit at slic.cellbio.duke.edu
(919) 684-8098    | bitnet  : tan00001 at dukemc.bitnet
--------------------------------------------------------
U.S. Mail:
Duke University Medical Center
Department Of Cell Biology
Box 3709
Nanaline Duke Bldg, Rm. 349
Durham, NC 27710



More information about the Comp.sys.sgi mailing list