The VAL function passes an item to a procedure by value. VAL is only used as an actual argument. The VAL function has largely been superceded by the CARG function.
Syntax
VAL (item)
item is an INTENT(IN) data object of type INTEGER, REAL, or LOGICAL. It is the data object for which to return a value.
The result is the value of item. Its C data type is as follows:
|
Fortran Type |
Fortran Kind |
C type |
|---|---|---|
|
INTEGER |
1 |
long int |
|
INTEGER |
2 |
long int |
|
INTEGER |
4 |
long int |
|
REAL |
4 |
float |
|
COMPLEX |
4 |
must not be passed by value; if passed by reference (without CARG) it is a pointer to a structure of the form: struct complex { float real_part; float imaginary_part;}; |
|
LOGICAL |
1 |
unsigned long |
|
LOGICAL |
4 |
unsigned long |
|
CHARACTER |
1 |
must not be passed by value with VAL |
Example
i=my_c_function(val(a)) ! a is passed by value