nawalnawal8
nawalnawal8

Reputation: 1

Array not compiling after 12 elements?

I'm trying to create an array, but my program will not compile if I have more than 12 elements in the array. For example:

PROGRAM dprime
REAL, DIMENSION(12) :: array
array = (/50.0,52.0,54.0,56.0,58.0,60.0,62.0,64.0,66.0,68.0,70.0,72.0/)
END PROGRAM dprime

Now, if I change it to DIMENSION(13) and add another element after 72.0, I get the following error:

Error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: , (/ : /).

This code will not compile:

PROGRAM dprime
REAL, DIMENSION(13) :: array
array =(/50.0,52.0,54.0,56.0,58.0,60.0,62.0,64.0,66.0,68.0,70.0,72.0,74.0/)
END PROGRAM

Where could there be an error?

Upvotes: 0

Views: 92

Answers (1)

Pierre de Buyl
Pierre de Buyl

Reputation: 7293

You are probably beyond the allowed line length.

For gfortran, add the option -ffree-line-length-none to the command line.

EDIT:

Most probably, just rename your file to *.f90 and you'll be set with most compilers, including ifort that you are using. This strategy has a limit: beyond 132 characters you must use continuation lines with the character & at the end of a line.

Upvotes: 1

Related Questions