Array


Sample C usage Fortran subroutine
#pragma linkage (cfort,FORTRAN)
#include <stdio.h>
void cfort(float[]);
main()
{
  float matrix[3] = {0.0F,1.0F,2.0F};
  cfort(matrix);
  printf
    ("Updated values in C: %f %f %f\n",
    matrix[0], matrix[1], matrix[2]);
}

 
SUBROUTINE CFORT ( ARG )
REAL*4 ARG(3)
PRINT *, 'FORTRAN ARG VALUES:', ARG
DO J = 1, 3
  ARG(J) = ARG(J) + 1.0
ENDDO
END