Allocatable arrays

Allocatable arrays

I asked a question before dealing with declaring arrays, and 'wilkinson' gave me this example code....

module data
integer max_element
integer, allocatable :: global_array(:)
end module data

prog.f90

program main
use data
integer i
max_element = 1000
allocate (global_array(max_element))
do i = 1, max_element
global_array(i) = i
end do
call sub
end subroutine sub
use data
type *, global_array(max_element/2)
return
end

I used the idea of the code and it worked perfectly. But on the line...
type *, global_array(max_element/2)
what exactly does the ' *, ' do? and how could this line be changed so it wont be prompted in MSDos mode. (I mean...when I run the program, the DOS window fills with zeros every time this line is run, how could I avoid this)

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Just remove it, I just included it to show that indeed there was data in the newly allocated array, but it doesn't add any functionality.

James

Leave a Comment

Please sign in to add a comment. Not a member? Join today