Returning values from C function?

Jeremy C cp200205@gmail.com
Tue Dec 26 20:21:00 GMT 2006


Greetings! I am able to make this function in C:

int hello_(int *times, char *to_who) {
  for (int idx=0; idx<*times; idx++) {
    printf("Hello, %s!\n", to_who);
  }

  return 10;
}

and in Fortran:

integer :: a

print *, hello(10, "Me")


I get "Hello, Me!" printed on the screen 10 times as expected, but it
prints what seems like a pointer address.

How can I return values from C? Basic values like Integer, Float and Strings?

Thanks,

Jeremy



More information about the Fortran mailing list