File: arrays_46.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 (27 lines) | stat: -rw-r--r-- 543 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
module module_arrays_46
integer :: nx = 4
integer :: ny = 4
end module module_arrays_46

subroutine a(cs)
use module_arrays_46
real, dimension(nx), intent(in) :: cs
print *, cs
if (abs(sum(cs) - 10.0) > 1e-8) error stop
end subroutine

subroutine b(cs)
use module_arrays_46
real, dimension(nx, ny), intent(in) :: cs
print *, sum(cs)
if (abs(sum(cs) - 205.919983) > 1e-8) error stop
end subroutine

program arrays_46
real, dimension(4) :: cs
real, dimension(4, 4) :: cs2
cs = [1.0, 2.0, 3.0, 4.0]
cs2 = 12.87
call a(cs)
call b(cs2)
end program