How to read CSV data with fields that contain spaces?

scalars can be allocatable. You can do

integer, allocatable :: x
allocate(x)
x = 42

Of course the above is a little silly, but is perfectly valid. One common case of an allocatable scalar is for polymorphic variables. I.e.

class(base_type), allocatable :: x
allocate(child_type :: x)

With deferred length characters you can do

character(len=:), allocatable :: string
allocate(character(len=42) :: string)
string = "Hello, World!" ! This automatically reallocates string to the length of "Hello, World!"
2 Likes