IO Fortran format command issue

Viewed 16

suppose we want to write the output of a n=16 element array of integers numbers A(n):

write(*,1) (A(k), k=1,n)
1 format(16(I2,2x))

we cannot write 1 format(n(I2,2x))

is there a way to overcome this problem? or do we need to change by hand the format command every time we change n?

0 Answers
Related