How To Access 3/4 Dimensional Arrays Using Pointers
From: Christopher M. Lusardi (clusardi2k_at_aol.com)
Date: 01/29/04
- Next message: Walt Brainerd: "Re: Intel Fortran for Windows, student edition costs $29."
- Previous message: Gary Strand: "Re: Bugs at my web site"
- Next in thread: Athanasios Migdalas: "Re: How To Access 3/4 Dimensional Arrays Using Pointers"
- Reply: Athanasios Migdalas: "Re: How To Access 3/4 Dimensional Arrays Using Pointers"
- Reply: glen herrmannsfeldt: "Re: How To Access 3/4 Dimensional Arrays Using Pointers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Jan 2004 12:12:41 -0800
Hello,
Can you tell me (with good examples) how to access 3 and 4 dimensional
Fortran arrays using pointers in C/C++? My program uses two languages. I have
arrays defined in Fortran. In C I am given the base address of the Fortran
arrays. How do I get the address of individual elements
EG: The following is the lower half of the addresses of a three dimensional
array.
Fortran declaration
int_tes (3,2,2)
Addresses
int_tes (1,1,1) = 548
int_tes (1,1,2) = 656
int_tes (1,2,1) = 602
int_tes (1,2,2) = 710
int_tes (2,1,1) = 566
int_tes (2,1,2) = 674
int_tes (2,2,1) = 620
int_tes (2,2,2) = 728
int_tes (3,1,1) = 584
int_tes (3,1,2) = 692
int_tes (3,2,1) = 638
int_tes (3,2,2) = 746
548 + 108 = 656 to go from element 1,1,1 to 1,1,2
548 + 18 = 566 to go from element 1,1,1 to 2,1,1
548 + 54 = 602 to go from element 1,1,1 to 1,2,1
The size of an integer is 3 bytes.
(1,,) (2,,) (3,,)
548 656 566 674 584 692
602 710 620 728 638 746
Thank you,
Christopher Lusardi
- Next message: Walt Brainerd: "Re: Intel Fortran for Windows, student edition costs $29."
- Previous message: Gary Strand: "Re: Bugs at my web site"
- Next in thread: Athanasios Migdalas: "Re: How To Access 3/4 Dimensional Arrays Using Pointers"
- Reply: Athanasios Migdalas: "Re: How To Access 3/4 Dimensional Arrays Using Pointers"
- Reply: glen herrmannsfeldt: "Re: How To Access 3/4 Dimensional Arrays Using Pointers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|