Allocatable arrays

Allocatable arrays

Imagen de Community Admin

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)

publicaciones de 2 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.
Imagen de james@elementyl.com

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

Inicie sesión para dejar un comentario.