So I have something like this:
INTEGER i
REAL value(10)
DO i = 1,5
value(i) = 1
ENDDO
So now my value = (1,1,1,1,1,0,0,0,0,0). What would be the function that gives size = 5 (the size of the array without the zeros)?
Just count the non-zero elements
print *, count(value/=0)
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