Skip to content

build/api-examples/Fortran.cpp

Complete program from the Fortran API reference. Save it at the path shown above and use the build command in the reference page.

Source files · Download Fortran.cpp

#include <cstdio>

extern "C" void scale_values(int n, double factor, double* values);

int main()
{
    double values[] = {1.0, 2.0, 3.0};
    scale_values(3, 2.0, values);
    std::printf("%.1f %.1f %.1f\n", values[0], values[1], values[2]);
    return 0;
}