Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

character array allocation, alternative definition fails

$
0
0

Hi all,

here the basics of allocated characters are discussed:

https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-fo...

Now I have the following minimal working example:

!
program character_array_allocation
  implicit none
  ! Variables
  character(len=:),dimension(:), allocatable :: foo

  allocate(character(len=10),dimension(20) :: foo) ! this fails
! 1>------ Build started: Project: character_array_allocation, Configuration: Debug Win32 ------
! 1>Compiling with Intel(R) Visual Fortran Compiler 17.0.1.143 [IA-32]...
! 1>character_array_allocation.f90
! 1>... \character_array_allocation.f90(7): error #5082: Syntax error, found ',' when expecting one of: . , [ % . ( :: )
! 1>compilation aborted for ... \character_array_allocation.f90 (code 1)


  !allocate(character(len=10) :: foo(20)) ! this works


end program character_array_allocation

Why causes the alternative format in line 7 a compiler error? The version in line 15 works fine.

Thanks, Johannes


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>