4.10 INTRINSIC Statement

The INTRINSIC statement lets you use names of intrinsic procedures as arguments to subprograms. It takes the following form:

INTRINSIC v [,v] . . .
v
Is the symbolic name of an intrinsic procedure.

Rules and Behavior

The INTRINSIC statement declares each symbolic name v to be the name of an intrinsic procedure. This name can then be used as an actual argument to a subprogram. The subprogram can then use the corresponding dummy argument in a function reference or a CALL statement.

Example

In the following example, when TRIG is called with a second argument of SIN or COS, the function reference F(X) references the Fortran library functions SIN and COS; but when TRIG is called with a second argument of CTN, F(X) references the user function CTN.

Main Program  Subprogram 
EXTERNAL CTN   SUBROUTINE TRIG(X,F,Y)  
INTRINSIC SIN, COS   Y = F(X)  
. . .  RETURN  
  END  
CALL TRIG(ANGLE,SIN,SINE)    
. . .  FUNCTION CTN(X)  
  CTN = COS(X)/SIN(X)  
CALL TRIG(ANGLE,COS,COSINE)   RETURN  
. . .  END  
CALL TRIG(ANGLE,CTN,COTANGENT)    

For More Information:


Previous Page Next Page Table of Contents