Skip to content

Instantly share code, notes, and snippets.

@Foadsf
Last active July 25, 2020 13:24
Show Gist options
  • Save Foadsf/f887f03a4cbf04921e98d7ccfc0e74b1 to your computer and use it in GitHub Desktop.
Save Foadsf/f887f03a4cbf04921e98d7ccfc0e74b1 to your computer and use it in GitHub Desktop.
/* File CMAIN.C */
#include <stdio.h>
extern int __stdcall FACT (int n);
extern void __stdcall PYTHAGORAS (float a, float b, float *c);
main()
{
float c;
printf("Factorial of 7 is: %d\n", FACT(7));
PYTHAGORAS (30, 40, &c);
printf("Hypotenuse if sides 30, 40 is: %f\n", c);
}
C File FORSUBS.FOR
C
INTEGER*4 FUNCTION Fact (n)
INTEGER*4 n [VALUE]
INTEGER*4 i, amt
amt = 1
DO i = 1, n
amt = amt * i
END DO
Fact = amt
END
SUBROUTINE Pythagoras (a, b, c)
REAL*4 a [VALUE]
REAL*4 b [VALUE]
REAL*4 c [REFERENCE]
c = SQRT (a * a + b * b)
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment