Fortran Programming Guide

Argument Order

Except for arguments that are character strings, Fortran and C pass arguments in the same order. However, for every argument of character type, the Fortran routine passes an additional argument giving the length of the string. These are long int quantities in C, passed by value.

The order of arguments is:

Example:


This Fortran code fragment:
Is equivalent to this in C:
      CHARACTER*7 S
      INTEGER B(3)
       ...
      CALL SAM( S, B(2) )
      char s[7];
      long b[3];
        ...
      sam_( s, &b[1], 7L ) ;