z/OS Language Environment Writing Interlanguage Communication Applications
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Address of an array

z/OS Language Environment Writing Interlanguage Communication Applications
SA38-0684-00

Sample C++ usage Fortran subroutine
extern "FORTRAN"
{ void cfort(int(**)[]); }
#include <stdio.h>
main()
{
  int matrix[3] = {0,1,2};
  int (*temp)[] = &matrix;
  cfort(&temp);
  printf
    ("Updated values in C: %d %d %d\n",
    matrix[0], matrix[1], matrix[2]);
}
SUBROUTINE CFORT ( ARG )
POINTER*4 (ARG, Y)
INTEGER*4 Y(3)
PRINT *,
1  'FORTRAN ARRAY ARG VALUES:', Y
DO J = 1, 3
  Y(J) = Y(J) + 1
ENDDO
END

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014