Fortran passage through homework control passage

I had a question that I was wrong, and I was wondering if anyone could explain this. Do not worry that the class is over, just wanted to find out why this is wrong. I asked several more students, and they had the same answer as mine. I also look at the line, but all the examples I found are the swap functions, which X = 1 bothers me.

    SUBROUTINE TEST(X,Y,Z)
    X=1
    Z=X+Y
    RETURN 
    END


    N=2
    CALL TEST ( N,N,M)

   WHAT WILL M BE IF PASSED BY REFERENCE?
   WHAT WILL M BE IF PASSED BY VALUE-RESULT?

I got 3 for the first and 4 for the second question.

+4
source share
1 answer

, X = 2, Y = 2 . X 1, Y 1, , ? (X + Y) = 2 == > Z = 2.
= 2.

: X = 2, Y = 2, X 1, Y, . Z = 3.
M = 3.

0

All Articles