home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 18971 < prev    next >
Encoding:
Text File  |  1992-12-29  |  964 b   |  25 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!math.fu-berlin.de!informatik.tu-muenchen.de!backscha
  3. From: backscha@Informatik.TU-Muenchen.DE (Martin Backschat)
  4. Subject: Accessing a dynamical 3-D field
  5. Originator: backscha@hpzenger1.informatik.tu-muenchen.de
  6. Sender: news@Informatik.TU-Muenchen.DE (USENET Newssystem)
  7. Organization: Technische Universitaet Muenchen, Germany
  8. Date: Tue, 29 Dec 1992 14:21:34 GMT
  9. Message-ID: <1992Dec29.142134.25641@Informatik.TU-Muenchen.DE>
  10. Lines: 13
  11.  
  12.  
  13. In my program I use 3-D fields of doubles with variable bounds.
  14. This field is implemented as an array of doubles which is allocated
  15. dynamically with malloc.
  16. To access for example the [i][j][k] component in the field f of dimension U,V,W
  17. I have to write   f[i*V*W + j*W + k].
  18.  
  19. Now my question:
  20.  
  21. Is it somehow possible to declare and allocate a 3-D field u (of doubles) with
  22. variable bounds, allocated by malloc, in such a way that it can be accessed
  23. with
  24. u[i,j,k] (with type casting)?
  25.