The program consists of two source files:

The Fortran source file, which consists of a main program unit that declares two initialized character variables and passes them to a C function.

The C source code, which consists of two functions:

get_string: receives the two character array arguments from Fortran and overwrites the strings in the arrays with new strings

fix_string_for_f90: processes the string in its character array argument to replace the null-terminating character with a blank character and

to blank-fill the remaining characters. This processing is necessary so that Fortran can manipulate the character variable.

The get_stringfunction has two additional arguments in its argument list, which pick up the hidden string length arguments that Fortran implicitly passes with each string argument.

The following are example C and Fortran programs.

C strings 119

Page 119
Image 119
HP UX Fortran Software manual Following are example C and Fortran programs, Strings