I got a question concerning the debugging of a fortran file. Thus I declared it with d(*) automaticaly. However during the debugging and the supervision of the array it just shows the first number of the according array and not the 60 others. (I use Fortran 95 compiler and Visual Studio 2010)
How can I still view all variables of the array?
Okay here comes one example for the code:
ia is a variable integer from the main routine depending on some input parameters.
subroutine abc(ia,a,b,c)
dimension d(*)
a = d(ia+1)
b = d(ia+2)
c = d(ia+3)
return
end
However for debugging it is useful to know the endities of d(*)
The only way I've found to do this is to use the Watch
window and add a watch for the array elements. Suppose your array is called d
, then I've found that watching the following expressions shows the values in the array:
d(2) ! which just shows the 2nd element in the array
d(1:10) ! which shows the first 10 elements of the array
d(1:12:2) ! which shows the odd numbered elements of the array from 1 to 11
And of course, for an array of length 60 such as you suggest you have, then the expression
d(61)
will show you what value is in the memory location to which that array address points.
Of course, you should really be declaring your array as d(:)
. If you do, then the VS debugger shows the entire array in the usual Locals
window.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With