]>
Commit | Line | Data |
---|---|---|
c63539ff ML |
1 | .. |
2 | Copyright 1988-2022 Free Software Foundation, Inc. | |
3 | This is part of the GCC manual. | |
4 | For copying conditions, see the copyright.rst file. | |
5 | ||
6 | .. index:: LOC, location of a variable in memory | |
7 | ||
8 | .. _loc: | |
9 | ||
10 | LOC --- Returns the address of a variable | |
11 | ***************************************** | |
12 | ||
13 | .. function:: LOC(X) | |
14 | ||
15 | ``LOC(X)`` returns the address of :samp:`{X}` as an integer. | |
16 | ||
17 | :param X: | |
18 | Variable of any type. | |
19 | ||
20 | :return: | |
21 | The return value is of type ``INTEGER``, with a ``KIND`` | |
22 | corresponding to the size (in bytes) of a memory address on the target | |
23 | machine. | |
24 | ||
25 | Standard: | |
26 | GNU extension | |
27 | ||
28 | Class: | |
29 | Inquiry function | |
30 | ||
31 | Syntax: | |
32 | .. code-block:: fortran | |
33 | ||
34 | RESULT = LOC(X) | |
35 | ||
36 | Example: | |
37 | .. code-block:: fortran | |
38 | ||
39 | program test_loc | |
40 | integer :: i | |
41 | real :: r | |
42 | i = loc(r) | |
43 | print *, i | |
3ed1b4ce | 44 | end program test_loc |