home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!uunet.ca!wildcan!sq!msb
- From: msb@sq.sq.com (Mark Brader)
- Subject: Re: Passing 2D dynamic array to function
- Message-ID: <1992Aug30.204509.28023@sq.sq.com>
- Organization: SoftQuad Inc., Toronto, Canada
- References: <chans.715195647@marsh>
- Date: Sun, 30 Aug 92 20:45:09 GMT
- Lines: 18
-
- > I have a 2D array declared as int **array.
-
- No, you have a pointer to pointer to int, which you are using to
- implement a 2D array. A real 2D array would be declared like
- this: int array[98][98];
-
- > How do I pass that to a function?? I've tried :-
- > int func (int **ar, int ...etc.)
-
- Correct, for what you are using. You then refer to the array elements
- in the called function exactly as you would in the caller, e.g. array[x][y]
- becomes ar[x][y].
- --
- Mark Brader | "I think it's safe to say that no person can hope to
- SoftQuad Inc., Toronto | achieve basic life competence without consulting my
- utzoo!sq!msb, msb@sq.com | work on a regular basis." -- Cecil Adams
-
- This article is in the public domain.
-