# Problem with array definition

**URL:** <https://fortran-lang.discourse.group/t/problem-with-array-definition/1163>\
**Category:** Help\
**Created:** [May 6, 2021, 5:57pm UTC](https://fortran-lang.discourse.group/t/problem-with-array-definition/1163 "2021-05-06T17:57:55Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![themos](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/themos/32/521_2.png) [@themos](https://fortran-lang.discourse.group/u/themos)\
**Post date:** [May 7, 2021, 10:18am UTC](https://fortran-lang.discourse.group/t/problem-with-array-definition/1163/9 "2021-05-07T10:18:25Z")

</div>

Hello,  
I am guessing you are using the gfortran compiler and you wrote something like this and saved it in a file foo.f.

```
c234567
      dimension a(6)
      a=[0,0,0, &
 0 ,0,0]
      end

```

What went wrong here is that you used free-format Fortran but the conventions of gfortran treat the contents of foo.f as fixed-form Fortran. In fixed-form the trailing ampersand (&) is an error (which is the _Error: Syntax error in array constructor at (1)_) and that first zero on line 3 is interpreted as a statement label and not part of a statement (which is the _Zero is not a valid statement label at (1)_)

If you write free-format Fortran you must either put it in a file with a filename extension that the compiler expects (most compilers will accept .f90 for this) or override the compiler’s defaults with a command line option (in gfortran’s case, _-ffree-form_)

---

_[View the full topic](https://fortran-lang.discourse.group/t/problem-with-array-definition/1163)._
