File: arrays_op_26.f90

package info (click to toggle)
lfortran 0.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 46,332 kB
  • sloc: cpp: 137,068; f90: 51,260; python: 6,444; ansic: 4,277; yacc: 2,285; fortran: 806; sh: 524; makefile: 30; javascript: 15
file content (29 lines) | stat: -rw-r--r-- 567 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
program arrays_op_26
    implicit none
    type t
        real, pointer :: x(:)
        real, pointer :: y(:)
    end type t
    real, target :: X(5), Y(5)
    type(t) :: t_1
    t_1%x => X
    t_1%y => Y
    call sub(t_1)
    print '(f10.2)', X
    if( any(X /= 2679.00) ) error stop

contains

subroutine sub(t_1)
    type(t), intent(inout) :: t_1
    real, dimension(size(t_1%x)) :: S
    integer :: i
    S = 5
    t_1%x = 54
    t_1%y = 21
    do i = 1, size(t_1%y)
        t_1%x = t_1%x + t_1%y(i) * S**2
    end do
end subroutine sub

end program arrays_op_26