reshape not working

reshape not working

I've been trying to resize a vector into a two dimensional array but at compile time I keep getting the same error message

Here is the program and the output

program prog2
integer::b(6)
b=(/ 1,2,3,4,5,6 /)
RESHAPE (b, (/2, 3/))
print 10, b
10 format (3(2X, I3))
end program prog2

# ifc -w reshape.f90 -o reshape
program PROG2

RESHAPE (b, (/2, 3/))
^
Error 395 at (4:reshape.f90) : This entity is not an array and must not be subscripted

1 Error

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

RESHAPE is a function, not a statement. The message is a bit obscure, but then again, the compiler was quite perplexed as to what you wanted.

CVF's message is essentially a syntax error...

You need to assign the result of RESHAPE to something, or use it in some context that requires an array.

Steve

Steve

Thanks Steve, I'll figure out my bum from my head one of these days

Login to leave a comment.