Message-ID: <350B7C5F.B8FD882F@wpol.com> From: John & Sue Kissell Reply-To: jdk AT wpol DOT com MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: HELP: Generic array pointer passed to function. References: <350B4789 DOT 282833FC AT wpol DOT com> <350B3C07 DOT 575D7E62 AT cornell DOT edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 42 Date: Sun, 15 Mar 1998 03:51:06 GMT NNTP-Posting-Host: 208.195.214.64 NNTP-Posting-Date: Sat, 14 Mar 1998 22:51:06 EST To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Thank you Sinan, I'll give it a try. A union is a good idea, the two simple functions and structures that I included are just a minor portion of what I need to code. A. Sinan Unur wrote: > John & Sue Kissell wrote: > > > > I need help in how to describe a generic array pointer passed to a > > function. > > i don't think you ment array pointer here. > > anyway, for your purposes, you might want to consider the following: > (i will have to add that this is kinda off-topic, but i thought it might > be useful. in any case, this sort of C questions would get better > answers in forums such as comp.lang.c.moderated.) > > i have a feeling the code below makes a case for using C++ ;-) > > /* > * constants for different kinds of windows > * for code that might need the information > */ > > #define WT_WINDOW 0 > #define WT_BUTTON 1 > /* etc */ > > typedef struct TAG_BUTTON_DATA > { > int x1; > int y1; > int x2; > int y2; > int state; > int frame; > } BUTTON_DATA; > > typedef struct TAG_WINDOW_DATA > { > char* title; > } WINDOW_DATA; > > typedef union TAG_DATA > { > BUTTON_DATA button; > WINDOW_DATA window; > } DATA; > > typedef struct TAG_WINDOW_T > { > int type; > int length; > int height; > int x; > int y; > COLOR_GROUP *color; > BITMAP *map; > DATA d; > } WINDOW_T; > > void paste(WINDOW_T *w, BITMAP *m) > { > int tmp=mouseflag; > if (tmp) > MouseOFF(); > blit(w->map, m, 0, 0, w->x, w->y, w->length, w->height); > if (tmp) > MouseON(); > return; > } > > -- Sinan