1! Program to test the LEN and LEN_TRIM intrinsics. 2subroutine test (c) 3 character(*) c 4 character(len(c)) d 5 6 d = c 7 if (len(d) .ne. 20) STOP 1 8 if (d .ne. "Longer Test String") STOP 2 9 c = "Hello World" 10end subroutine 11 12subroutine test2 (c) 13 character (*) c 14 character(len(c)) d 15 16 d = c 17 if (len(d) .ne. 6) STOP 3 18 if (d .ne. "Foobar") STOP 4 19end subroutine 20 21program strlen 22 implicit none 23 character(20) c 24 character(5) a, b 25 integer i 26 27 c = "Longer Test String" 28 call test (c) 29 30 if (len(c) .ne. 20) STOP 5 31 if (len_trim(c) .ne. 11) STOP 6 32 33 call test2 ("Foobar"); 34end program 35