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 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

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 - Intel Developer Support

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

登陆并发表评论。