home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / acorn / 7957 next >
Encoding:
Internet Message Format  |  1992-07-20  |  1.3 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!mips!mips!munnari.oz.au!comp.vuw.ac.nz!waikato.ac.nz!mcg
  2. From: mcg@waikato.ac.nz
  3. Newsgroups: comp.sys.acorn
  4. Subject: Passing N-dim array to a function in C?
  5. Message-ID: <1992Jul21.173107.9517@waikato.ac.nz>
  6. Date: 21 Jul 92 17:31:07 +1200
  7. Organization: University of Waikato, Hamilton, New Zealand
  8. Lines: 39
  9.  
  10. A question for those C moguls out there:-
  11.  
  12.      One can declare a function
  13.  
  14.     void matrix (double *m)
  15.     {
  16.      blah
  17.    }
  18.  
  19. and pass it an array declared : double t[10];
  20.  
  21.      matrix(t);
  22.  
  23.  
  24.  What is the data_type declaration that's necessary for an array of an array?
  25.  
  26. viz
  27.  
  28.     void  matrix(????)
  29.     {   double *p = malloc(sizeof (m));
  30.       m[1,4] = 1.0123;
  31.       p[3,9] = 1.20394;
  32.     ..}
  33.  
  34.  for declaration of : double t[10][10];
  35.  
  36. From Martin Glanvill        (mcg@waikato.ac.nz)
  37.  
  38. Dept. Maths                                   @@@@@/|@
  39. University of Waikato                              @@@@/ |@
  40. Hamilton                                  @@@/__|@
  41. New Zealand                                  @@/   |@
  42.                                       @@@@@@@@
  43.  
  44. ----------------****=====| A quote to make your day |======****-----------------
  45. If a jury in a criminal trial stays out for more than twenty-four hours, it is
  46.  certain to vote acquittal, save in those instances where it votes guilty.
  47.                                         -- Joseph C. Goulden
  48. -------------------------------------------------------------------------------
  49.