[ANSYS, Inc. Logo] return to home search
next up previous contents index

A.15 Comparison with FORTRAN

Many simple C functions are similar to FORTRAN function subroutines as shown in the example below:


A simple C function An equivalent FORTRAN function
   
int myfunction(int x) INTEGER FUNCTION MYFUNCTION(X)
{  
int x,y,z; INTEGER X,Y,Z
y = 11; Y = 11
z = x+y; Z = X+Y
printf("z = %d",z); WRITE (*,100) Z
return z; MYFUNCTION = Z
} END
   


next up previous contents index Previous: A.14 Preprocessor Directives
Up: A. C Programming Basics
Next: B. DEFINE Macro Definitions
Release 12.0 © ANSYS, Inc. 2009-01-14